Skip to content

Commit

Permalink
fix tests affected by moving Resource.options with annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Jul 12, 2021
1 parent aa8277f commit d41dc33
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/internal/target/kusttarget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,5 @@ metadata:
actual.RemoveBuildAnnotations()
actYaml, err := actual.AsYaml()
assert.NoError(t, err)
assert.Equal(t, expYaml, actYaml)
assert.Equal(t, string(expYaml), string(actYaml))
}
2 changes: 2 additions & 0 deletions api/krusty/configmaps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ configMapGenerator:
behavior: merge
literals:
- ANOTHER_ENV_VARIABLE="bar"
options:
disableNameSuffixHash: true
`)
th.WriteF("cm.yaml", `
apiVersion: v1
Expand Down
3 changes: 3 additions & 0 deletions api/resmap/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,10 @@ BAR=baz
}
r, err := rmF.NewResMapFromConfigMapArgs(kvLdr, tc.input)
assert.NoError(t, err, tc.description)
r.RemoveBuildAnnotations()
rYaml, err := r.AsYaml()
assert.NoError(t, err, tc.description)
tc.expected.RemoveBuildAnnotations()
expYaml, err := tc.expected.AsYaml()
assert.NoError(t, err, tc.description)
assert.Equal(t, expYaml, rYaml)
Expand Down Expand Up @@ -252,6 +254,7 @@ func TestNewResMapFromSecretArgs(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
actual.RemoveBuildAnnotations()
actYaml, err := actual.AsYaml()
assert.NoError(t, err)

Expand Down
3 changes: 3 additions & 0 deletions api/resmap/reswrangler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,8 @@ func TestAbsorbAll(t *testing.T) {
}))
w := makeMap1()
assert.NoError(t, w.AbsorbAll(makeMap2(types.BehaviorMerge)))
expected.RemoveBuildAnnotations()
w.RemoveBuildAnnotations()
assert.NoError(t, expected.ErrorIfNotEqualLists(w))
w = makeMap1()
assert.NoError(t, w.AbsorbAll(nil))
Expand All @@ -853,6 +855,7 @@ func TestAbsorbAll(t *testing.T) {
w = makeMap1()
w2 := makeMap2(types.BehaviorReplace)
assert.NoError(t, w.AbsorbAll(w2))
w2.RemoveBuildAnnotations()
assert.NoError(t, w2.ErrorIfNotEqualLists(w))
w = makeMap1()
w2 = makeMap2(types.BehaviorUnspecified)
Expand Down
6 changes: 2 additions & 4 deletions api/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ var testConfigMap = factory.FromMap(
},
})

const genArgOptions = "{nsfx:false,beh:unspecified}"

//nolint:gosec
const configMapAsString = `{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"winnie","namespace":"hundred-acre-wood"}}`

Expand Down Expand Up @@ -66,11 +64,11 @@ func TestResourceString(t *testing.T) {
}{
{
in: testConfigMap,
s: configMapAsString + genArgOptions,
s: configMapAsString,
},
{
in: testDeployment,
s: deploymentAsString + genArgOptions,
s: deploymentAsString,
},
}
for _, test := range tests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,4 @@ kind: ConfigMap
metadata:
name: example-configmap-test
`)
if m.Resources()[0].NeedHashSuffix() != true {
t.Errorf("expected resource to need hashing")
}
}

0 comments on commit d41dc33

Please sign in to comment.