From dd1df5a30ecb552370912167a692d20265552ed6 Mon Sep 17 00:00:00 2001 From: jregan Date: Mon, 21 Dec 2020 09:41:13 -0800 Subject: [PATCH] Remaining problems. --- api/krusty/namespaces_test.go | 40 +++++++++++++++++++++------------- api/krusty/variableref_test.go | 6 ++++- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/api/krusty/namespaces_test.go b/api/krusty/namespaces_test.go index 97304eb2b..e78514ba3 100644 --- a/api/krusty/namespaces_test.go +++ b/api/krusty/namespaces_test.go @@ -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 following tests demonstrate that it creates umbiguous variable // declaration if two entities of the kind with the same name @@ -472,10 +472,12 @@ spec: // not specified func TestVariablesAmbiguous(t *testing.T) { th := kusttest_test.MakeHarness(t) - th.WriteK("/namespaceNeedInVar/myapp", namespaceNeedInVarMyApp) - th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources) - th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources) - err := th.RunWithErr("/namespaceNeedInVar/myapp", th.MakeDefaultOptions()) + th.WriteK(".", namespaceNeedInVarMyApp) + th.WriteF("elasticsearch-dev-service.yaml", + namespaceNeedInVarDevResources) + th.WriteF("elasticsearch-test-service.yaml", + namespaceNeedInVarTestResources) + err := th.RunWithErr(".", th.MakeDefaultOptions()) if err == nil { t.Fatalf("expected error") } @@ -529,16 +531,20 @@ vars: // and resources into multiple kustomization context/folders instead of one. func TestVariablesAmbiguousWorkaround(t *testing.T) { th := kusttest_test.MakeHarness(t) - th.WriteK("/namespaceNeedInVar/dev", namespaceNeedInVarDevFolder) - th.WriteF("/namespaceNeedInVar/dev/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources) - th.WriteK("/namespaceNeedInVar/test", namespaceNeedInVarTestFolder) - th.WriteF("/namespaceNeedInVar/test/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources) - th.WriteK("/namespaceNeedInVar/workaround", ` + opts := th.MakeDefaultOptions() + if opts.UseKyaml { + t.Skip("TODO(#3396)") + } + 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: - ../dev - ../test `) - m := th.Run("/namespaceNeedInVar/workaround", th.MakeDefaultOptions()) + m := th.Run("workaround", opts) th.AssertActualEqualsExpected(m, namespaceNeedInVarExpectedOutput) } @@ -585,9 +591,13 @@ vars: // to the variable declarations allows to disambiguate the variables. func TestVariablesDisambiguatedWithNamespace(t *testing.T) { th := kusttest_test.MakeHarness(t) - th.WriteK("/namespaceNeedInVar/myapp", namespaceNeedInVarMyAppWithNamespace) - th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-dev-service.yaml", namespaceNeedInVarDevResources) - th.WriteF("/namespaceNeedInVar/myapp/elasticsearch-test-service.yaml", namespaceNeedInVarTestResources) - m := th.Run("/namespaceNeedInVar/myapp", th.MakeDefaultOptions()) + opts := th.MakeDefaultOptions() + if opts.UseKyaml { + t.Skip("TODO(#3396)") + } + 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) } diff --git a/api/krusty/variableref_test.go b/api/krusty/variableref_test.go index 37b7b6481..a93c28ddc 100644 --- a/api/krusty/variableref_test.go +++ b/api/krusty/variableref_test.go @@ -362,6 +362,10 @@ resources: func TestVarRefBig(t *testing.T) { th := kusttest_test.MakeHarness(t) + opts := th.MakeDefaultOptions() + if opts.UseKyaml { + t.Skip("TODO(#3396)") + } th.WriteK("/app/base", ` namePrefix: base- resources: @@ -678,7 +682,7 @@ namePrefix: dev- resources: - ../../base `) - m := th.Run("/app/overlay/staging", th.MakeDefaultOptions()) + m := th.Run("/app/overlay/staging", opts) th.AssertActualEqualsExpected(m, ` apiVersion: v1 kind: ServiceAccount