mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Merge pull request #3382 from monopole/emptyMapMania
Isolate tests related to #3396
This commit is contained in:
@@ -307,7 +307,7 @@ metadata:
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This serie of constants is used to prove the need of
|
// This series of constants is used to prove the need of
|
||||||
// the namespace field in the objref field of the var declaration.
|
// the namespace field in the objref field of the var declaration.
|
||||||
// The following tests demonstrate that it creates umbiguous variable
|
// The following tests demonstrate that it creates umbiguous variable
|
||||||
// declaration if two entities of the kind with the same name
|
// declaration if two entities of the kind with the same name
|
||||||
@@ -472,10 +472,12 @@ spec:
|
|||||||
// not specified
|
// not specified
|
||||||
func TestVariablesAmbiguous(t *testing.T) {
|
func TestVariablesAmbiguous(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK("/namespaceNeedInVar/myapp", namespaceNeedInVarMyApp)
|
th.WriteK(".", namespaceNeedInVarMyApp)
|
||||||
th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources)
|
th.WriteF("elasticsearch-dev-service.yaml",
|
||||||
th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources)
|
namespaceNeedInVarDevResources)
|
||||||
err := th.RunWithErr("/namespaceNeedInVar/myapp", th.MakeDefaultOptions())
|
th.WriteF("elasticsearch-test-service.yaml",
|
||||||
|
namespaceNeedInVarTestResources)
|
||||||
|
err := th.RunWithErr(".", th.MakeDefaultOptions())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("expected error")
|
t.Fatalf("expected error")
|
||||||
}
|
}
|
||||||
@@ -529,16 +531,20 @@ vars:
|
|||||||
// and resources into multiple kustomization context/folders instead of one.
|
// and resources into multiple kustomization context/folders instead of one.
|
||||||
func TestVariablesAmbiguousWorkaround(t *testing.T) {
|
func TestVariablesAmbiguousWorkaround(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK("/namespaceNeedInVar/dev", namespaceNeedInVarDevFolder)
|
opts := th.MakeDefaultOptions()
|
||||||
th.WriteF("/namespaceNeedInVar/dev/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources)
|
if opts.UseKyaml {
|
||||||
th.WriteK("/namespaceNeedInVar/test", namespaceNeedInVarTestFolder)
|
t.Skip("TODO(#3396)")
|
||||||
th.WriteF("/namespaceNeedInVar/test/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources)
|
}
|
||||||
th.WriteK("/namespaceNeedInVar/workaround", `
|
th.WriteK("dev", namespaceNeedInVarDevFolder)
|
||||||
|
th.WriteF("dev/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources)
|
||||||
|
th.WriteK("test", namespaceNeedInVarTestFolder)
|
||||||
|
th.WriteF("test/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources)
|
||||||
|
th.WriteK("workaround", `
|
||||||
resources:
|
resources:
|
||||||
- ../dev
|
- ../dev
|
||||||
- ../test
|
- ../test
|
||||||
`)
|
`)
|
||||||
m := th.Run("/namespaceNeedInVar/workaround", th.MakeDefaultOptions())
|
m := th.Run("workaround", opts)
|
||||||
th.AssertActualEqualsExpected(m, namespaceNeedInVarExpectedOutput)
|
th.AssertActualEqualsExpected(m, namespaceNeedInVarExpectedOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,9 +591,13 @@ vars:
|
|||||||
// to the variable declarations allows to disambiguate the variables.
|
// to the variable declarations allows to disambiguate the variables.
|
||||||
func TestVariablesDisambiguatedWithNamespace(t *testing.T) {
|
func TestVariablesDisambiguatedWithNamespace(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK("/namespaceNeedInVar/myapp", namespaceNeedInVarMyAppWithNamespace)
|
opts := th.MakeDefaultOptions()
|
||||||
th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources)
|
if opts.UseKyaml {
|
||||||
th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources)
|
t.Skip("TODO(#3396)")
|
||||||
m := th.Run("/namespaceNeedInVar/myapp", th.MakeDefaultOptions())
|
}
|
||||||
|
th.WriteK(".", namespaceNeedInVarMyAppWithNamespace)
|
||||||
|
th.WriteF("elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources)
|
||||||
|
th.WriteF("elasticsearch-test-service.yaml", namespaceNeedInVarTestResources)
|
||||||
|
m := th.Run(".", th.MakeDefaultOptions())
|
||||||
th.AssertActualEqualsExpected(m, namespaceNeedInVarExpectedOutput)
|
th.AssertActualEqualsExpected(m, namespaceNeedInVarExpectedOutput)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,6 +362,10 @@ resources:
|
|||||||
|
|
||||||
func TestVarRefBig(t *testing.T) {
|
func TestVarRefBig(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
|
opts := th.MakeDefaultOptions()
|
||||||
|
if opts.UseKyaml {
|
||||||
|
t.Skip("TODO(#3396)")
|
||||||
|
}
|
||||||
th.WriteK("/app/base", `
|
th.WriteK("/app/base", `
|
||||||
namePrefix: base-
|
namePrefix: base-
|
||||||
resources:
|
resources:
|
||||||
@@ -678,7 +682,7 @@ namePrefix: dev-
|
|||||||
resources:
|
resources:
|
||||||
- ../../base
|
- ../../base
|
||||||
`)
|
`)
|
||||||
m := th.Run("/app/overlay/staging", th.MakeDefaultOptions())
|
m := th.Run("/app/overlay/staging", opts)
|
||||||
th.AssertActualEqualsExpected(m, `
|
th.AssertActualEqualsExpected(m, `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
|
|||||||
Reference in New Issue
Block a user