mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
IsInKustomizeCtx should use end of nameprefix array (2/3)
Update unit tests associated with in IsSameKustomizeCtx
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
package target_test
|
package target_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/v3/pkg/kusttest"
|
"sigs.k8s.io/kustomize/v3/pkg/kusttest"
|
||||||
@@ -369,100 +370,11 @@ metadata:
|
|||||||
name: serviceaccount
|
name: serviceaccount
|
||||||
`)
|
`)
|
||||||
|
|
||||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
_, err := th.MakeKustTarget().MakeCustomizedResMap()
|
||||||
if err != nil {
|
if err == nil {
|
||||||
t.Fatalf("Unexpected err: %v", err)
|
t.Fatalf("expected error")
|
||||||
|
}
|
||||||
|
if !strings.Contains(err.Error(), "multiple matches for ~G_v1_ServiceAccount|~X|serviceaccount") {
|
||||||
|
t.Fatalf("unexpected error %v", err)
|
||||||
}
|
}
|
||||||
th.AssertActualEqualsExpected(m, `
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: a-serviceaccount-suffixA
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: a-pfx-serviceaccount-sfx-suffixA
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: RoleBinding
|
|
||||||
metadata:
|
|
||||||
name: a-pfx-rolebinding-sfx-suffixA
|
|
||||||
roleRef:
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
kind: ClusterRole
|
|
||||||
name: a-pfx-role-sfx-suffixA
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: a-pfx-serviceaccount-sfx-suffixA
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRoleBinding
|
|
||||||
metadata:
|
|
||||||
name: a-pfx-rolebinding-sfx-suffixA
|
|
||||||
roleRef:
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
kind: ClusterRole
|
|
||||||
name: a-pfx-role-sfx-suffixA
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: a-pfx-serviceaccount-sfx-suffixA
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: a-pfx-role-sfx-suffixA
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- secrets
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- watch
|
|
||||||
- list
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: b-pfx-serviceaccount-sfx-suffixB
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: RoleBinding
|
|
||||||
metadata:
|
|
||||||
name: b-pfx-rolebinding-sfx-suffixB
|
|
||||||
roleRef:
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
kind: ClusterRole
|
|
||||||
name: b-pfx-role-sfx-suffixB
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: b-pfx-serviceaccount-sfx-suffixB
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRoleBinding
|
|
||||||
metadata:
|
|
||||||
name: b-pfx-rolebinding-sfx-suffixB
|
|
||||||
roleRef:
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
kind: ClusterRole
|
|
||||||
name: b-pfx-role-sfx-suffixB
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: b-pfx-serviceaccount-sfx-suffixB
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: b-pfx-role-sfx-suffixB
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- secrets
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- watch
|
|
||||||
- list
|
|
||||||
`)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user