Modify tests to present expected data in unsorted order.

Modify all `build` tests to use the raw,
non-sorted output of build.  This makes every test
provide coverage for how kustomize re-orders (or
doesn't reorder) resources during processing.

Going forward, the ordering of resources in
_expected_ output should match the depth-first
ordering specified in the `resources:` field used
in the test's kustomization file.

The only exception to this rule would be tests
that actually confirmed some other output
ordering, e.g. the test of the
`LegacyOrderTransformer` plugin.

Fixes #756
Related #821
This commit is contained in:
Jeffrey Regan
2019-06-17 14:41:43 -07:00
parent ed21e77fb1
commit 0b555e1b2c
21 changed files with 613 additions and 582 deletions

View File

@@ -78,7 +78,7 @@ configMapGenerator:
th.WriteK("/app/overlay", `
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
resources:
- ../base
generatorOptions:
disableNameSuffixHash: false
@@ -95,15 +95,6 @@ configMapGenerator:
}
th.AssertActualEqualsExpected(m, `
apiVersion: v1
data:
fruit: apple
kind: ConfigMap
metadata:
labels:
fruit: apple
name: shouldHaveHash-2k9hc848ff
---
apiVersion: v1
data:
foo: bar
kind: ConfigMap
@@ -111,5 +102,14 @@ metadata:
labels:
foo: bar
name: shouldNotHaveHash
---
apiVersion: v1
data:
fruit: apple
kind: ConfigMap
metadata:
labels:
fruit: apple
name: shouldHaveHash-2k9hc848ff
`)
}