Skip to content

Commit

Permalink
only run tink tests on main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gwesterfieldjr committed Jun 17, 2022
1 parent bc85293 commit b573822
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions internal/test/e2e/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func RunTests(conf instanceRunConf) (testInstanceID string, testCommandResult *t
}

success = testCommandResult.Successful()
logger.V(1).Info("Instance Test Result", "instance", instanceId, "success", success)

if err = conf.runPostTestsProcessing(session, testCommandResult); err != nil {
return session.instanceId, nil, err
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion test/framework/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit b573822

Please sign in to comment.