diff --git a/tests/framework/installer/installer.go b/tests/framework/installer/installer.go index 2c97d6500..a86749c33 100644 --- a/tests/framework/installer/installer.go +++ b/tests/framework/installer/installer.go @@ -12,6 +12,7 @@ import ( "path/filepath" "strings" "testing" + "time" mondoov2 "go.mondoo.com/mondoo-operator/api/v1alpha2" "go.mondoo.com/mondoo-operator/pkg/utils/k8s" @@ -64,6 +65,10 @@ func (i *MondooInstaller) InstallOperator() error { } zap.S().Info("The Mondoo operator is installed externally. Skipping installation...") + // We had race conditions were the integration wasn't ready when the operator tried to exchange the token + // for a service account. This sleep should give the integration enough time to get ready. + zap.S().Infof("Sleeping for 30 seconds to allow the token to get active") + time.Sleep(30 * time.Second) return nil } @@ -122,6 +127,13 @@ func (i *MondooInstaller) UninstallOperator() error { } zap.S().Infof("Deleted Mondoo client secret %s/%s.", secret.Namespace, secret.Name) + // A new suite gets a new integration/token, so cleanup the old one. + secret.Name = utils.MondooTokenSecret + if err := i.K8sHelper.DeleteResourceIfExists(secret); err != nil { + return err + } + zap.S().Infof("Deleted Mondoo token secret %s/%s.", secret.Namespace, secret.Name) + if i.isInstalledExternally { zap.S().Info("The Mondoo operator has been installed externally. Skipping uninstall...") return nil diff --git a/tests/framework/nexus/client.go b/tests/framework/nexus/client.go index 7e1ad850c..55d726c55 100644 --- a/tests/framework/nexus/client.go +++ b/tests/framework/nexus/client.go @@ -37,6 +37,8 @@ func NewClient() (*Client, error) { if apiToken == "" { return nil, fmt.Errorf("missing environment variable %s", MONDOO_API_TOKEN_VAR) } + fmt.Printf("Using GraphQL endpoint %s\n", gqlEndpoint) + fmt.Printf("Using org MRN %s\n", orgMrn) // Initialize the client client, err := mondoogql.NewClient(option.WithEndpoint(gqlEndpoint), option.WithAPIToken(apiToken)) if err != nil {