mirror of https://github.com/k3s-io/k3s
Merge pull request #71955 from apelisse/automated-cherry-pick-of-#71923-upstream-release-1.13
Automated cherry pick of #71923: diff: Fix overlapping filenamespull/58/head
commit
eec55b9ba9
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: test
|
|
@ -0,0 +1,17 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: test
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: test
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: test
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: test
|
|
@ -289,7 +289,17 @@ func (obj InfoObject) Merged() (runtime.Object, error) {
|
|||
}
|
||||
|
||||
func (obj InfoObject) Name() string {
|
||||
return obj.Info.Name
|
||||
group := ""
|
||||
if obj.Info.Mapping.GroupVersionKind.Group != "" {
|
||||
group = fmt.Sprintf("%v.", obj.Info.Mapping.GroupVersionKind.Group)
|
||||
}
|
||||
return group + fmt.Sprintf(
|
||||
"%v.%v.%v.%v",
|
||||
obj.Info.Mapping.GroupVersionKind.Version,
|
||||
obj.Info.Mapping.GroupVersionKind.Kind,
|
||||
obj.Info.Namespace,
|
||||
obj.Info.Name,
|
||||
)
|
||||
}
|
||||
|
||||
// Differ creates two DiffVersion and diffs them.
|
||||
|
|
|
@ -40,3 +40,20 @@ run_kubectl_diff_tests() {
|
|||
set +o nounset
|
||||
set +o errexit
|
||||
}
|
||||
|
||||
run_kubectl_diff_same_names() {
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
|
||||
create_and_use_new_namespace
|
||||
kube::log::status "Test kubectl diff with multiple resources with the same name"
|
||||
|
||||
output_message=$(KUBECTL_EXTERNAL_DIFF=find kubectl diff -Rf hack/testdata/diff/)
|
||||
kube::test::if_has_string "${output_message}" 'v1\.Pod\..*\.test'
|
||||
kube::test::if_has_string "${output_message}" 'apps\.v1\.Deployment\..*\.test'
|
||||
kube::test::if_has_string "${output_message}" 'v1\.ConfigMap\..*\.test'
|
||||
kube::test::if_has_string "${output_message}" 'v1\.Secret\..*\.test'
|
||||
|
||||
set +o nounset
|
||||
set +o errexit
|
||||
}
|
||||
|
|
|
@ -473,6 +473,7 @@ runTests() {
|
|||
# Kubectl diff #
|
||||
################
|
||||
record_command run_kubectl_diff_tests
|
||||
record_command run_kubectl_diff_same_names
|
||||
|
||||
###############
|
||||
# Kubectl get #
|
||||
|
|
Loading…
Reference in New Issue