Skip to content

Commit

Permalink
fix: update some values in the data of RPA for FBC
Browse files Browse the repository at this point in the history
Signed-off-by: Jing Qi <[email protected]>

Correct the type of some values in the data of RPA for FBC test case
  • Loading branch information
jinqi7 committed Dec 4, 2024
1 parent 5ea0b8c commit e774672
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/release/pipelines/fbc_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcReleasePlanName, devNamespace, fbcApplicationName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createFBCReleasePlanAdmission(fbcReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, fbcApplicationName, fbcEnterpriseContractPolicyName, relSvcCatalogPathInRepo, "false", "", "", "", "", "false")
createFBCReleasePlanAdmission(fbcReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, fbcApplicationName, fbcEnterpriseContractPolicyName, relSvcCatalogPathInRepo, false, "", false, "", "", false)

createFBCEnterpriseContractPolicy(fbcEnterpriseContractPolicyName, *managedFw, devNamespace, managedNamespace)
snapshot, err = releasecommon.CreateSnapshotWithImageSource(*devFw, fbcComponentName, fbcApplicationName, devNamespace, sampleImage, fbcSourceGitURL, fbcGitSrcSHA, "", "", "", "")
Expand Down Expand Up @@ -134,7 +134,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcStagedRPName, devNamespace, fbcStagedAppName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createFBCReleasePlanAdmission(fbcStagedRPAName, *managedFw, devNamespace, managedNamespace, fbcStagedAppName, fbcStagedECPolicyName, relSvcCatalogPathInRepo, "false", "", "", "", "", "true")
createFBCReleasePlanAdmission(fbcStagedRPAName, *managedFw, devNamespace, managedNamespace, fbcStagedAppName, fbcStagedECPolicyName, relSvcCatalogPathInRepo, false, "", false, "", "", true)

createFBCEnterpriseContractPolicy(fbcStagedECPolicyName, *managedFw, devNamespace, managedNamespace)
snapshot, err = releasecommon.CreateSnapshotWithImageSource(*devFw, fbcStagedCompName, fbcStagedAppName, devNamespace, sampleImage, fbcSourceGitURL, fbcGitSrcSHA, "", "", "", "")
Expand Down Expand Up @@ -181,7 +181,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcHotfixRPName, devNamespace, fbcHotfixAppName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createFBCReleasePlanAdmission(fbcHotfixRPAName, *managedFw, devNamespace, managedNamespace, fbcHotfixAppName, fbcHotfixECPolicyName, relSvcCatalogPathInRepo, "true", issueId, "false", "", "", "false")
createFBCReleasePlanAdmission(fbcHotfixRPAName, *managedFw, devNamespace, managedNamespace, fbcHotfixAppName, fbcHotfixECPolicyName, relSvcCatalogPathInRepo, true, issueId, false, "", "", false)

createFBCEnterpriseContractPolicy(fbcHotfixECPolicyName, *managedFw, devNamespace, managedNamespace)

Expand Down Expand Up @@ -230,7 +230,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
Expect(err).NotTo(HaveOccurred())

createFBCEnterpriseContractPolicy(fbcPreGAECPolicyName, *managedFw, devNamespace, managedNamespace)
createFBCReleasePlanAdmission(fbcPreGARPAName, *managedFw, devNamespace, managedNamespace, fbcPreGAAppName, fbcPreGAECPolicyName, relSvcCatalogPathInRepo, "false", issueId, "true", productName, productVersion, "false")
createFBCReleasePlanAdmission(fbcPreGARPAName, *managedFw, devNamespace, managedNamespace, fbcPreGAAppName, fbcPreGAECPolicyName, relSvcCatalogPathInRepo, false, issueId, true, productName, productVersion, false)

snapshot, err = releasecommon.CreateSnapshotWithImageSource(*devFw, fbcPreGACompName, fbcPreGAAppName, devNamespace, sampleImage, fbcSourceGitURL, fbcGitSrcSHA, "", "", "", "")
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -339,15 +339,27 @@ func createFBCEnterpriseContractPolicy(fbcECPName string, managedFw framework.Fr

}

func createFBCReleasePlanAdmission(fbcRPAName string, managedFw framework.Framework, devNamespace, managedNamespace, fbcAppName, fbcECPName, pathInRepoValue, hotfix, issueId, preGA, productName, productVersion, isStagedIndex string) {
func createFBCReleasePlanAdmission(fbcRPAName string, managedFw framework.Framework, devNamespace, managedNamespace, fbcAppName, fbcECPName, pathInRepoValue string, hotfix bool, issueId string, preGA bool, productName, productVersion string, isStagedIndex bool) {
var err error
var targetIndex string

if productName == "" {
productName = "testProductName"
}
if isStagedIndex == true {

Check failure on line 349 in tests/release/pipelines/fbc_release.go

View workflow job for this annotation

GitHub Actions / lint

S1002: should omit comparison to bool constant, can be simplified to `isStagedIndex` (gosimple)
targetIndex = ""
} else {
targetIndex = constants.TargetIndex
}

data, err := json.Marshal(map[string]interface{}{
"fbc": map[string]interface{}{
"fromIndex": constants.FromIndex,
"stagedIndex": isStagedIndex,
"targetIndex": targetIndex,
"publishingCredentials": "fbc-preview-publishing-credentials",
"requestUpdateTimeout": "1500",
"buildTimeoutSeconds": "1500",
"requestTimeoutSeconds": 1500,
"buildTimeoutSeconds": 1500,
"hotfix": hotfix,
"issueId": issueId,
"preGA": preGA,
Expand All @@ -361,18 +373,6 @@ func createFBCReleasePlanAdmission(fbcRPAName string, managedFw framework.Framew
})
Expect(err).NotTo(HaveOccurred())

var structData map[string]interface{}
err = json.Unmarshal(data, &structData)
Expect(err).NotTo(HaveOccurred())

if isStagedIndex == "true" {
structData["fbc"].(map[string]interface{})["targetIndex"] = ""
} else {
structData["fbc"].(map[string]interface{})["targetIndex"] = constants.TargetIndex
}
data, err = json.Marshal(structData)
Expect(err).NotTo(HaveOccurred())

_, err = managedFw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(fbcRPAName, managedNamespace, "", devNamespace, fbcECPName, fbcServiceAccountName, []string{fbcAppName}, true, &tektonutils.PipelineRef{
Resolver: "git",
Params: []tektonutils.Param{
Expand Down

0 comments on commit e774672

Please sign in to comment.