mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 01:46:23 +00:00
Add tests in support of Issue 3489.
This commit is contained in:
@@ -15,7 +15,6 @@ func TestNamePrefixSuffixPatch(t *testing.T) {
|
||||
|
||||
th.WriteF("handlers/kustomization.yaml", `
|
||||
nameSuffix: -suffix
|
||||
|
||||
resources:
|
||||
- deployment.yaml
|
||||
`)
|
||||
|
||||
@@ -7,6 +7,54 @@ import (
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
func TestIssue3489Simplified(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
th.WriteK(".", `
|
||||
namespace: kube-system
|
||||
resources:
|
||||
- aa
|
||||
- bb
|
||||
`)
|
||||
th.WriteK("aa", `
|
||||
resources:
|
||||
- ../base
|
||||
`)
|
||||
th.WriteK("bb", `
|
||||
resources:
|
||||
- ../base
|
||||
nameSuffix: -private
|
||||
`)
|
||||
th.WriteK("base", `
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- serviceAccount.yaml
|
||||
`)
|
||||
th.WriteF("base/deployment.yaml", `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: myDep
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: mySvcAcct
|
||||
containers:
|
||||
- name: whatever
|
||||
image: k8s.gcr.io/governmentCheese
|
||||
`)
|
||||
th.WriteF("base/serviceAccount.yaml", `
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: mySvcAcct
|
||||
`)
|
||||
// TODO(3489): This shouldn't be an error.
|
||||
err := th.RunWithErr(".", th.MakeDefaultOptions())
|
||||
if !strings.Contains(err.Error(), "found multiple possible referrals") {
|
||||
t.Fatalf("unexpected error: %q", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssue3489(t *testing.T) {
|
||||
const assets = `{
|
||||
"tenantId": "XXXXX-XXXXXX-XXXXX-XXXXXX-XXXXXX",
|
||||
|
||||
@@ -53,7 +53,7 @@ resources:
|
||||
// This validates fix for Issue #1044. This should not be an error anymore -
|
||||
// the secrets have the same name but are in different namespaces.
|
||||
// The ClusterRole (by def) is not in a namespace,
|
||||
// an in this case applies to *any* Secret resource
|
||||
// and in this case applies to *any* Secret resource
|
||||
// named "dummy"
|
||||
m := th.Run("/app", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
@@ -91,7 +91,7 @@ rules:
|
||||
`)
|
||||
}
|
||||
|
||||
func TestNameReferenceDeployment(t *testing.T) {
|
||||
func TestNameReferenceDeploymentIssue3489(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
th.WriteK("base", `
|
||||
resources:
|
||||
|
||||
Reference in New Issue
Block a user