From 345d57621d1fe8ea7b12d0ad46108097c89334b4 Mon Sep 17 00:00:00 2001 From: Greg Westerfield Date: Thu, 16 Jun 2022 19:45:07 -0400 Subject: [PATCH] only run tink tests on main branch --- internal/test/e2e/run.go | 17 +++++++++++++++-- test/framework/cluster.go | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/internal/test/e2e/run.go b/internal/test/e2e/run.go index e8e9525c0fae9..7c0984fce518c 100644 --- a/internal/test/e2e/run.go +++ b/internal/test/e2e/run.go @@ -164,6 +164,7 @@ func RunTests(conf instanceRunConf) (testInstanceID string, testCommandResult *t } success = testCommandResult.Successful() + logger.V(1).Info("Instance Test Result", "instance", instanceId, "result", success) if err = conf.runPostTestsProcessing(session, testCommandResult); err != nil { return session.instanceId, nil, err @@ -236,6 +237,8 @@ func (e *E2ESession) commandWithEnvVars(command string) string { } func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, error) { + var runConfs []instanceRunConf + testPerInstance := len(testsList) / conf.MaxInstances if testPerInstance == 0 { testPerInstance = 1 @@ -246,7 +249,6 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er privateNetworkTestsRe := regexp.MustCompile(`^.*(Proxy|RegistryMirror).*$`) multiClusterTestsRe := regexp.MustCompile(`^.*Multicluster.*$`) - runConfs := make([]instanceRunConf, 0, conf.MaxInstances) ipman := newE2EIPManager(os.Getenv(cidrVar), os.Getenv(privateNetworkCidrVar)) awsSession, err := session.NewSession() @@ -289,7 +291,18 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er } } - err = s3.DownloadToDisk(awsSession, os.Getenv(tinkerbellHardwareS3FileKeyEnvVar), conf.StorageBucket, e2eHardwareCsvFilePath) + if strings.EqualFold(conf.BranchName, "main") { + runConfs, err = splitTinkerbellTests(awsSession, testsList, conf, testRunnerConfig, runConfs) + if err != nil { + return nil, fmt.Errorf("failed to split Tinkerbell tests: %v", err) + } + } + + return runConfs, nil +} + +func splitTinkerbellTests(awsSession *session.Session, testsList []string, conf ParallelRunConf, testRunnerConfig *TestInfraConfig, runConfs []instanceRunConf) ([]instanceRunConf, error) { + err := s3.DownloadToDisk(awsSession, os.Getenv(tinkerbellHardwareS3FileKeyEnvVar), conf.StorageBucket, e2eHardwareCsvFilePath) if err != nil { return nil, fmt.Errorf("failed to download tinkerbell hardware csv: %v", err) } diff --git a/test/framework/cluster.go b/test/framework/cluster.go index 386db42a1fdd9..1006e86404869 100644 --- a/test/framework/cluster.go +++ b/test/framework/cluster.go @@ -315,7 +315,7 @@ func (e *ClusterE2ETest) ValidateHardwareDecommissioned() { powerState, err := bmcClient.GetPowerState(ctx) // add sleep retries to give the machine time to power off timeout := 15 - for strings.EqualFold(powerState, string(rapi.Off)) && timeout > 0 { + for !strings.EqualFold(powerState, string(rapi.Off)) && timeout > 0 { if err != nil { e.T.Logf("failed to get power state for hardware (%v): %v", h, err) }