Skip to content

Commit

Permalink
add a unit test for BuildAnnotationsGenAddHashSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
yutaroyamanaka committed Apr 8, 2023
1 parent 229568f commit ff894ed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api/resmap/reswrangler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/api/filters/labels"
"sigs.k8s.io/kustomize/api/internal/utils"
"sigs.k8s.io/kustomize/api/provider"
. "sigs.k8s.io/kustomize/api/resmap"
"sigs.k8s.io/kustomize/api/resource"
Expand Down Expand Up @@ -895,6 +896,16 @@ func TestAbsorbAll(t *testing.T) {
assert.Error(t, err)
assert.True(
t, strings.Contains(err.Error(), "behavior must be merge or replace"))

// Assure BuildAnnotationsGenAddHashSuffix is not deleted after AbsorbAll
w = makeMap1()
w.RemoveBuildAnnotations()
w2 = makeMap2(types.BehaviorReplace)
assert.NoError(t, w.AbsorbAll(w2))
expected = makeMap2(types.BehaviorUnspecified)
expected.RemoveBuildAnnotations()
expected.AnnotateAll(utils.BuildAnnotationsGenAddHashSuffix, "enabled")
assert.NoError(t, w.ErrorIfNotEqualLists(expected))
}

func TestToRNodeSlice(t *testing.T) {
Expand Down

0 comments on commit ff894ed

Please sign in to comment.