Skip to content

Commit

Permalink
fix: Do not fail reconciliation when CDStageDeploy exists (#47)
Browse files Browse the repository at this point in the history
We should treat this as normal situation and do not fail

JIRA: EPMDEDM-13477

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
Change-Id: Ib1d14fd584cd0f4719635a013170c6049be8dfe4
  • Loading branch information
SergK committed Mar 11, 2024
1 parent 5e7bc4a commit b4b22df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions controllers/codebaseimagestream/chain/put_cd_stage_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ func (h PutCDStageDeploy) putCDStageDeploy(envLabel, namespace string, spec code
if stageDeploy != nil {
h.log.Info("CDStageDeploy already exists. skip creating.", logNameKey, stageDeploy.Name)

return &util.CDStageDeployHasNotBeenProcessedError{
Message: fmt.Sprintf("%v has not been processed for previous version of application yet", name),
}
return nil
}

cdsd, err := getCreateCommand(envLabel, name, namespace, spec.Codebase, spec.Tags, log)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestPutCDStageDeploy_CdstagedeployShouldFailOnSearch(t *testing.T) {
}
}

func TestPutCDStageDeploy_ShouldFailWhenCdstagedeployExist(t *testing.T) {
func TestPutCDStageDeploy_ShouldPassWhenCdstagedeployExist(t *testing.T) {
cis := &codebaseApi.CodebaseImageStream{
ObjectMeta: metaV1.ObjectMeta{
Name: "cbis-name",
Expand Down Expand Up @@ -212,10 +212,10 @@ func TestPutCDStageDeploy_ShouldFailWhenCdstagedeployExist(t *testing.T) {
}

err := chain.ServeRequest(cis)
assert.Error(t, err)
assert.NoError(t, err)

if !strings.Contains(err.Error(), "pipeline-name-stage-name has not been processed for previous version of application yet") {
t.Fatalf("wrong error returned: %s", err.Error())
if err != nil {
t.Fatalf("unexpected error returned: %s", err.Error())
}
}

Expand Down

0 comments on commit b4b22df

Please sign in to comment.