Skip to content

Commit

Permalink
test login with one node
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Oct 18, 2022
1 parent 25e39d9 commit b0a4ee4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions integration/scenario_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func IntegrationSkip(t *testing.T) {

func TestHeadscale(t *testing.T) {
IntegrationSkip(t)

var err error

scenario, err := NewScenario()
Expand Down Expand Up @@ -106,6 +107,8 @@ func TestTailscaleNodesJoiningHeadcale(t *testing.T) {

namespace := "join-node-test"

count := 1

scenario, err := NewScenario()
if err != nil {
t.Errorf("failed to create scenario: %s", err)
Expand Down Expand Up @@ -137,13 +140,13 @@ func TestTailscaleNodesJoiningHeadcale(t *testing.T) {
})

t.Run("create-tailscale", func(t *testing.T) {
err := scenario.CreateTailscaleNodesInNamespace(namespace, "1.32.0", 2)
err := scenario.CreateTailscaleNodesInNamespace(namespace, "1.30.2", count)
if err != nil {
t.Errorf("failed to add tailscale nodes: %s", err)
}

if clients := len(scenario.namespaces[namespace].Clients); clients != 2 {
t.Errorf("wrong number of tailscale clients: %d != %d", clients, 2)
if clients := len(scenario.namespaces[namespace].Clients); clients != count {
t.Errorf("wrong number of tailscale clients: %d != %d", clients, count)
}
})

Expand All @@ -157,7 +160,17 @@ func TestTailscaleNodesJoiningHeadcale(t *testing.T) {
if err != nil {
t.Errorf("failed to login: %s", err)
}
})

t.Run("get-ips", func(t *testing.T) {
ips, err := scenario.GetIPs(namespace)
if err != nil {
t.Errorf("failed to get tailscale ips: %s", err)
}

if len(ips) != count*2 {
t.Errorf("got the wrong amount of tailscale ips, %d != %d", len(ips), count*2)
}
})

err = scenario.Shutdown()
Expand Down

0 comments on commit b0a4ee4

Please sign in to comment.