Skip to content

Commit

Permalink
fix: RHTAPBUGS-1013: increase random string in branch names. (konflux…
Browse files Browse the repository at this point in the history
…-ci#929)

Signed-off-by: Radim Hopp <[email protected]>
  • Loading branch information
rhopp authored Dec 4, 2023
1 parent 7078fa7 commit 5b5e0ed
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions tests/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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))

})

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))

})

Expand Down Expand Up @@ -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{})
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion tests/build/jvm-build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion tests/byoc/byoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
Expand Down
2 changes: 1 addition & 1 deletion tests/integration-service/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration-service/status-reporting-to-pullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion tests/rhtap-demo/rhtap-demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 5b5e0ed

Please sign in to comment.