Skip to content

Commit

Permalink
Move auth and client init into BeforeEach to improve Ginkgo errors (#…
Browse files Browse the repository at this point in the history
…1321)

Move auth and client initialization in canary upgrade tests into BeforeEach to improve Ginkgo error reporting

Co-authored-by: Moritz Clasmeier <[email protected]>
  • Loading branch information
mclasmeier and Moritz Clasmeier authored Oct 10, 2023
1 parent 632532f commit b812a8a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions e2e/e2e_canary_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit b812a8a

Please sign in to comment.