diff --git a/e2e/e2e_canary_upgrade_test.go b/e2e/e2e_canary_upgrade_test.go index ead68c8ef1..98b636e763 100644 --- a/e2e/e2e_canary_upgrade_test.go +++ b/e2e/e2e_canary_upgrade_test.go @@ -36,23 +36,24 @@ func operatorConfigForVersion(version string) operator.OperatorConfig { } var _ = Describe("Fleetshard-sync Targeted Upgrade", func() { + var client *fleetmanager.Client + var err error BeforeEach(func() { if !features.TargetedOperatorUpgrades.Enabled() { Skip("Skipping canary upgrade test") } + option := fleetmanager.OptionFromEnv() + auth, err := fleetmanager.NewStaticAuth(fleetmanager.StaticOption{StaticToken: option.Static.StaticToken}) + Expect(err).ToNot(HaveOccurred()) + client, err = fleetmanager.NewClient(fleetManagerEndpoint, auth) + Expect(err).ToNot(HaveOccurred()) }) if fmEndpointEnv := os.Getenv("FLEET_MANAGER_ENDPOINT"); fmEndpointEnv != "" { fleetManagerEndpoint = fmEndpointEnv } - option := fleetmanager.OptionFromEnv() - auth, err := fleetmanager.NewStaticAuth(fleetmanager.StaticOption{StaticToken: option.Static.StaticToken}) - Expect(err).ToNot(HaveOccurred()) - client, err := fleetmanager.NewClient(fleetManagerEndpoint, auth) - Expect(err).ToNot(HaveOccurred()) - operatorConfig1 := operatorConfigForVersion("4.1.1") operatorConfig2 := operatorConfigForVersion("4.1.2")