Skip to content

Commit

Permalink
introduce a version subset we must test against
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Sep 5, 2023
1 parent b4a4d0f commit f8a58aa
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cmd/build-docker-img/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func main() {
log.Fatalf("failed to create or get network: %s", err)
}

for _, version := range integration.TailscaleVersions {
for _, version := range integration.AllVersions {
log.Printf("creating container image for Tailscale (%s)", version)

tsClient, err := tsic.New(
Expand Down
4 changes: 2 additions & 2 deletions integration/auth_oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestOIDCAuthenticationPingAll(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user1": len(MustTestVersions),
}

oidcConfig, err := scenario.runMockOIDC(defaultAccessTTL)
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestOIDCExpireNodesBasedOnTokenExpiry(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user1": len(MustTestVersions),
}

oidcConfig, err := scenario.runMockOIDC(shortAccessTTL)
Expand Down
8 changes: 4 additions & 4 deletions integration/auth_web_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func TestAuthWebFlowAuthenticationPingAll(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user2": len(TailscaleVersions),
"user1": len(MustTestVersions),
"user2": len(MustTestVersions),
}

err = scenario.CreateHeadscaleEnv(spec, hsic.WithTestName("webauthping"))
Expand Down Expand Up @@ -74,8 +74,8 @@ func TestAuthWebFlowLogoutAndRelogin(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user2": len(TailscaleVersions),
"user1": len(MustTestVersions),
"user2": len(MustTestVersions),
}

err = scenario.CreateHeadscaleEnv(spec, hsic.WithTestName("weblogout"))
Expand Down
4 changes: 2 additions & 2 deletions integration/embedded_derp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestDERPServerScenario(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user1": len(MustTestVersions),
}

headscaleConfig := map[string]string{}
Expand Down Expand Up @@ -164,7 +164,7 @@ func (s *EmbeddedDERPServerScenario) CreateTailscaleIsolatedNodesInUser(

version := requestedVersion
if requestedVersion == "all" {
version = TailscaleVersions[clientN%len(TailscaleVersions)]
version = MustTestVersions[clientN%len(MustTestVersions)]
}

cert := hsServer.GetCert()
Expand Down
28 changes: 14 additions & 14 deletions integration/general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func TestPingAllByIP(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user2": len(TailscaleVersions),
"user1": len(MustTestVersions),
"user2": len(MustTestVersions),
}

err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("pingallbyip"))
Expand Down Expand Up @@ -58,8 +58,8 @@ func TestAuthKeyLogoutAndRelogin(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user2": len(TailscaleVersions),
"user1": len(MustTestVersions),
"user2": len(MustTestVersions),
}

err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("pingallbyip"))
Expand Down Expand Up @@ -165,8 +165,8 @@ func TestEphemeral(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user2": len(TailscaleVersions),
"user1": len(MustTestVersions),
"user2": len(MustTestVersions),
}

headscale, err := scenario.Headscale(hsic.WithTestName("ephemeral"))
Expand Down Expand Up @@ -249,8 +249,8 @@ func TestPingAllByHostname(t *testing.T) {

spec := map[string]int{
// Omit 1.16.2 (-1) because it does not have the FQDN field
"user3": len(TailscaleVersions) - 1,
"user4": len(TailscaleVersions) - 1,
"user3": len(MustTestVersions) - 1,
"user4": len(MustTestVersions) - 1,
}

err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("pingallbyname"))
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestTaildrop(t *testing.T) {

spec := map[string]int{
// Omit 1.16.2 (-1) because it does not have the FQDN field
"taildrop": len(TailscaleVersions) - 1,
"taildrop": len(MustTestVersions) - 1,
}

err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("taildrop"))
Expand Down Expand Up @@ -408,8 +408,8 @@ func TestResolveMagicDNS(t *testing.T) {

spec := map[string]int{
// Omit 1.16.2 (-1) because it does not have the FQDN field
"magicdns1": len(TailscaleVersions) - 1,
"magicdns2": len(TailscaleVersions) - 1,
"magicdns1": len(MustTestVersions) - 1,
"magicdns2": len(MustTestVersions) - 1,
}

err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("magicdns"))
Expand Down Expand Up @@ -474,7 +474,7 @@ func TestExpireNode(t *testing.T) {
defer scenario.Shutdown()

spec := map[string]int{
"user1": len(TailscaleVersions),
"user1": len(MustTestVersions),
}

err = scenario.CreateHeadscaleEnv(spec, []tsic.Option{}, hsic.WithTestName("expirenode"))
Expand All @@ -501,7 +501,7 @@ func TestExpireNode(t *testing.T) {
assertNoErr(t, err)

// Assert that we have the original count - self
assert.Len(t, status.Peers(), len(TailscaleVersions)-1)
assert.Len(t, status.Peers(), len(MustTestVersions)-1)
}

headscale, err := scenario.Headscale()
Expand Down Expand Up @@ -536,7 +536,7 @@ func TestExpireNode(t *testing.T) {

if client.Hostname() != machine.Name {
// Assert that we have the original count - self - expired node
assert.Len(t, status.Peers(), len(TailscaleVersions)-2)
assert.Len(t, status.Peers(), len(MustTestVersions)-2)
}
}
}
19 changes: 15 additions & 4 deletions integration/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var (
tailscaleVersions2019 = []string{
"1.28",
"1.26",
"1.24",
"1.24", // Tailscale SSH
"1.22",
"1.20",
"1.18",
Expand All @@ -63,7 +63,7 @@ var (
// "1.8.7",
// }.

// TailscaleVersions represents a list of Tailscale versions the suite
// AllVersions represents a list of Tailscale versions the suite
// uses to test compatibility with the ControlServer.
//
// The list contains two special cases, "head" and "unstable" which
Expand All @@ -72,10 +72,21 @@ var (
//
// The rest of the version represents Tailscale versions that can be
// found in Tailscale's apt repository.
TailscaleVersions = append(
AllVersions = append(
tailscaleVersions2021,
tailscaleVersions2019...,
)

// MustTestVersions is the minimum set of versions we should test.
// At the moment, this is arbitrarily choosen as:
//
// - Two unstable (HEAD and unstable)
// - Two latest versions
// - Two oldest versions
MustTestVersions = append(
tailscaleVersions2021[0:4],
tailscaleVersions2019[len(tailscaleVersions2019)-2:len(tailscaleVersions2019)]...,
)
)

// User represents a User in the ControlServer and a map of TailscaleClient's
Expand Down Expand Up @@ -277,7 +288,7 @@ func (s *Scenario) CreateTailscaleNodesInUser(
for i := 0; i < count; i++ {
version := requestedVersion
if requestedVersion == "all" {
version = TailscaleVersions[i%len(TailscaleVersions)]
version = MustTestVersions[i%len(MustTestVersions)]
}

headscale, err := s.Headscale()
Expand Down
10 changes: 5 additions & 5 deletions integration/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestSSHOneUserAllToAll(t *testing.T) {
},
},
},
len(TailscaleVersions)-5,
len(MustTestVersions)-2,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -151,7 +151,7 @@ func TestSSHMultipleUsersAllToAll(t *testing.T) {
},
},
},
len(TailscaleVersions)-5,
len(MustTestVersions)-2,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -197,7 +197,7 @@ func TestSSHNoSSHConfigured(t *testing.T) {
},
SSHs: []policy.SSH{},
},
len(TailscaleVersions)-5,
len(MustTestVersions)-2,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -246,7 +246,7 @@ func TestSSHIsBlockedInACL(t *testing.T) {
},
},
},
len(TailscaleVersions)-5,
len(MustTestVersions)-2,
)
defer scenario.Shutdown()

Expand Down Expand Up @@ -302,7 +302,7 @@ func TestSSUserOnlyIsolation(t *testing.T) {
},
},
},
len(TailscaleVersions)-5,
len(MustTestVersions)-2,
)
defer scenario.Shutdown()

Expand Down

0 comments on commit f8a58aa

Please sign in to comment.