From 5b5e0ed00d213ca609720454b22117f6dc279a31 Mon Sep 17 00:00:00 2001 From: Radim Hopp Date: Mon, 4 Dec 2023 08:51:53 +0100 Subject: [PATCH] fix: RHTAPBUGS-1013: increase random string in branch names. (#929) Signed-off-by: Radim Hopp --- tests/build/build.go | 22 +++++++++---------- tests/build/jvm-build.go | 2 +- tests/byoc/byoc.go | 2 +- tests/integration-service/integration.go | 2 +- .../status-reporting-to-pullrequest.go | 4 ++-- tests/rhtap-demo/rhtap-demo.go | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/build/build.go b/tests/build/build.go index e4052da59..c8f04f520 100644 --- a/tests/build/build.go +++ b/tests/build/build.go @@ -80,14 +80,14 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " Succeed(), fmt.Sprintf("timed out waiting for gitops content to be created for app %s in namespace %s: %+v", app.Name, app.Namespace, err), ) - componentName = fmt.Sprintf("%s-%s", "test-component-pac", util.GenerateRandomString(4)) + componentName = fmt.Sprintf("%s-%s", "test-component-pac", util.GenerateRandomString(6)) pacBranchName = constants.PaCPullRequestBranchPrefix + componentName - componentBaseBranchName = fmt.Sprintf("base-%s", util.GenerateRandomString(4)) + componentBaseBranchName = fmt.Sprintf("base-%s", util.GenerateRandomString(6)) err = f.AsKubeAdmin.CommonController.Github.CreateRef(helloWorldComponentGitSourceRepoName, helloWorldComponentDefaultBranch, helloWorldComponentRevision, componentBaseBranchName) Expect(err).ShouldNot(HaveOccurred()) - defaultBranchTestComponentName = fmt.Sprintf("test-custom-default-branch-%s", util.GenerateRandomString(4)) + defaultBranchTestComponentName = fmt.Sprintf("test-custom-default-branch-%s", util.GenerateRandomString(6)) }) AfterAll(func() { @@ -595,12 +595,12 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " Succeed(), fmt.Sprintf("timed out waiting for gitops content to be created for app %s in namespace %s: %+v", app.Name, app.Namespace, err), ) - multiComponentBaseBranchName = fmt.Sprintf("multi-component-base-%s", util.GenerateRandomString(4)) + multiComponentBaseBranchName = fmt.Sprintf("multi-component-base-%s", util.GenerateRandomString(6)) err = f.AsKubeAdmin.CommonController.Github.CreateRef(multiComponentGitSourceRepoName, multiComponentDefaultBranch, multiComponentGitRevision, multiComponentBaseBranchName) Expect(err).ShouldNot(HaveOccurred()) //Branch for creating pull request - multiComponentPRBranchName = fmt.Sprintf("%s-%s", "pr-branch", util.GenerateRandomString(4)) + multiComponentPRBranchName = fmt.Sprintf("%s-%s", "pr-branch", util.GenerateRandomString(6)) }) @@ -634,7 +634,7 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " for _, contextDir := range multiComponentContextDirs { contextDir := contextDir - componentName := fmt.Sprintf("%s-%s", contextDir, util.GenerateRandomString(4)) + componentName := fmt.Sprintf("%s-%s", contextDir, util.GenerateRandomString(6)) pacBranchName := constants.PaCPullRequestBranchPrefix + componentName pacBranchNames = append(pacBranchNames, pacBranchName) @@ -763,7 +763,7 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " Succeed(), fmt.Sprintf("timed out waiting for gitops content to be created for app %s in namespace %s: %+v", app.Name, app.Namespace, err), ) - compName = fmt.Sprintf("%s-%s", multiComponentContextDirs[0], util.GenerateRandomString(4)) + compName = fmt.Sprintf("%s-%s", multiComponentContextDirs[0], util.GenerateRandomString(6)) componentObj := appservice.ComponentSpec{ ComponentName: compName, @@ -841,7 +841,7 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " Succeed(), fmt.Sprintf("timed out waiting for gitops content to be created for app %s in namespace %s: %+v", app.Name, app.Namespace, err), ) - componentName = fmt.Sprintf("%s-%s", "test-annotations", util.GenerateRandomString(4)) + componentName = fmt.Sprintf("%s-%s", "test-annotations", util.GenerateRandomString(6)) }) @@ -1036,12 +1036,12 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " Succeed(), fmt.Sprintf("timed out waiting for gitops content to be created for app %s in namespace %s: %+v", app.Name, app.Namespace, err), ) - componentName = fmt.Sprintf("build-suite-test-component-image-source-%s", util.GenerateRandomString(4)) + componentName = fmt.Sprintf("build-suite-test-component-image-source-%s", util.GenerateRandomString(6)) outputContainerImage := "" timeout = time.Second * 10 // Create a component with containerImageSource being defined component := appservice.ComponentSpec{ - ComponentName: fmt.Sprintf("build-suite-test-component-image-source-%s", util.GenerateRandomString(4)), + ComponentName: fmt.Sprintf("build-suite-test-component-image-source-%s", util.GenerateRandomString(6)), ContainerImage: containerImageSource, } _, err = f.AsKubeAdmin.HasController.CreateComponent(component, testNamespace, outputContainerImage, "", applicationName, true, map[string]string{}) @@ -1187,7 +1187,7 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " }) It("default Pipeline bundle should be used and no additional Pipeline params should be added to the PipelineRun if one of the WhenConditions does not match", func() { - notMatchingComponentName := componentName + util.GenerateRandomString(4) + notMatchingComponentName := componentName + util.GenerateRandomString(6) // using cdq since git ref is not known cdq, err := f.AsKubeAdmin.HasController.CreateComponentDetectionQuery(notMatchingComponentName, testNamespace, helloWorldComponentGitSourceURL, "", "", "", false) Expect(err).NotTo(HaveOccurred()) diff --git a/tests/build/jvm-build.go b/tests/build/jvm-build.go index 0ffbed2d7..0a9c29219 100644 --- a/tests/build/jvm-build.go +++ b/tests/build/jvm-build.go @@ -119,7 +119,7 @@ var _ = framework.JVMBuildSuiteDescribe("JVM Build Service E2E tests", Label("jv Succeed(), fmt.Sprintf("timed out waiting for gitops content to be created for app %s in namespace %s: %+v", app.Name, app.Namespace, err), ) - componentName = fmt.Sprintf("jvm-build-suite-component-%s", util.GenerateRandomString(4)) + componentName = fmt.Sprintf("jvm-build-suite-component-%s", util.GenerateRandomString(6)) // Create a component with Git Source URL being defined componentObj := appservice.ComponentSpec{ diff --git a/tests/byoc/byoc.go b/tests/byoc/byoc.go index 64df26c25..828eef698 100644 --- a/tests/byoc/byoc.go +++ b/tests/byoc/byoc.go @@ -222,7 +222,7 @@ var _ = framework.ByocSuiteDescribe(Label("byoc"), Ordered, func() { }) It("creates Red Hat AppStudio Quarkus component", func() { - compDetected.ComponentStub.ComponentName = util.GenerateRandomString(4) + compDetected.ComponentStub.ComponentName = util.GenerateRandomString(6) componentObj, err = fw.AsKubeAdmin.HasController.CreateComponent(compDetected.ComponentStub, fw.UserNamespace, "", "", applicationName, true, map[string]string{}) Expect(err).NotTo(HaveOccurred()) }) diff --git a/tests/integration-service/integration.go b/tests/integration-service/integration.go index 4c33378d2..601654965 100644 --- a/tests/integration-service/integration.go +++ b/tests/integration-service/integration.go @@ -315,7 +315,7 @@ func createApp(f framework.Framework, testNamespace string) string { func createComponent(f framework.Framework, testNamespace, applicationName string) (string, *appstudioApi.Component) { var originalComponent *appstudioApi.Component - componentName := fmt.Sprintf("integration-suite-test-component-git-source-%s", util.GenerateRandomString(4)) + componentName := fmt.Sprintf("integration-suite-test-component-git-source-%s", util.GenerateRandomString(6)) // Create a component with Git Source URL being defined // using cdq since git ref is not known cdq, err := f.AsKubeAdmin.HasController.CreateComponentDetectionQuery(componentName, testNamespace, componentRepoURL, "", "", "", false) diff --git a/tests/integration-service/status-reporting-to-pullrequest.go b/tests/integration-service/status-reporting-to-pullrequest.go index 1be2c0800..3347e0314 100644 --- a/tests/integration-service/status-reporting-to-pullrequest.go +++ b/tests/integration-service/status-reporting-to-pullrequest.go @@ -58,9 +58,9 @@ var _ = framework.IntegrationServiceSuiteDescribe("Status Reporting of Integrati integrationTestScenarioFail, err = f.AsKubeAdmin.IntegrationController.CreateIntegrationTestScenario_beta1(applicationName, testNamespace, gitURL, revision, pathInRepoForReportingFail) Expect(err).ShouldNot(HaveOccurred()) - componentName = fmt.Sprintf("%s-%s", "test-component-pac", util.GenerateRandomString(4)) + componentName = fmt.Sprintf("%s-%s", "test-component-pac", util.GenerateRandomString(6)) pacBranchName = constants.PaCPullRequestBranchPrefix + componentName - componentBaseBranchName = fmt.Sprintf("base-%s", util.GenerateRandomString(4)) + componentBaseBranchName = fmt.Sprintf("base-%s", util.GenerateRandomString(6)) err = f.AsKubeAdmin.CommonController.Github.CreateRef(componentRepoNameForStatusReporting, componentDefaultBranch, componentRevision, componentBaseBranchName) Expect(err).ShouldNot(HaveOccurred()) diff --git a/tests/rhtap-demo/rhtap-demo.go b/tests/rhtap-demo/rhtap-demo.go index 8b1b498c0..18598641e 100644 --- a/tests/rhtap-demo/rhtap-demo.go +++ b/tests/rhtap-demo/rhtap-demo.go @@ -195,7 +195,7 @@ var _ = framework.RhtapDemoSuiteDescribe(Label("rhtap-demo"), func() { // we need to create a new branch that we will target // and that will contain the PaC configuration, so we can avoid polluting the default (main) branch if componentSpec.AdvancedBuildSpec != nil { - componentNewBaseBranch = fmt.Sprintf("base-%s", util.GenerateRandomString(4)) + componentNewBaseBranch = fmt.Sprintf("base-%s", util.GenerateRandomString(6)) gitRevision = componentNewBaseBranch Expect(fw.AsKubeAdmin.CommonController.Github.CreateRef(componentRepositoryName, componentSpec.GitSourceDefaultBranchName, componentSpec.GitSourceRevision, componentNewBaseBranch)).To(Succeed()) }