Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: 117503445 <[email protected]>
  • Loading branch information
117503445 committed Jun 21, 2024
1 parent 59ce850 commit 4117795
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions integration/general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,13 +913,6 @@ func TestDERPVerify(t *testing.T) {
err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("derpverify"))
assertNoErrHeadscaleEnv(t, err)

allClients, err := scenario.ListTailscaleClients()
assertNoErrListClients(t, err)

t.Logf("All clients: %v", allClients)

t.Logf("len(server) = %d", scenario.controlServers.Size())

var controlServer ControlServer
scenario.controlServers.Range(
func(key string, value ControlServer) bool {
Expand All @@ -931,16 +924,7 @@ func TestDERPVerify(t *testing.T) {
t.Fatalf("no control server found")
}

t.Logf("controlServer: %v", controlServer)

t.Logf("hostname: %s, ip: %s", controlServer.GetHostname(), controlServer.GetIP())

t.Logf("controlServer.GetEndpoint(): %s", controlServer.GetEndpoint())

// derpServer.SetVerifyClientURL()

// https://github.com/tailscale/tailscale/blob/964282d34f06ecc06ce644769c66b0b31d118340/derp/derp_server.go#L1159

sendDerpVerifyRequest := func(t *testing.T, pub string) *tailcfg.DERPAdmitClientResponse {
jreq, err := json.Marshal(
map[string]interface{}{
Expand All @@ -958,14 +942,14 @@ func TestDERPVerify(t *testing.T) {
var jres tailcfg.DERPAdmitClientResponse
err = json.NewDecoder(io.LimitReader(res.Body, 4<<10)).Decode(&jres)
assertNoErr(t, err)
t.Log(jres.Allow)

return &jres
}

// Test that the DERP server rejects a node that is not in the user's list.
resp := sendDerpVerifyRequest(t, key.NewNode().Public().String())
assert.False(t, resp.Allow)

// Test that the DERP server accepts a node that is in the user's list.
nodes, err := controlServer.ListNodesInUser("user1")
assertNoErr(t, err)
resp = sendDerpVerifyRequest(t, nodes[0].NodeKey)
Expand Down

0 comments on commit 4117795

Please sign in to comment.