// Use original name, but new kind
// Should fail, even after #3280 is done, because this ID is invalid
Use original name, but new kind
Should fail, even after #3280 is done, because this ID is invalid
// Use original name but new kind // Should fail even after #3280 is done because this ID is invalid
func TestPatchOriginalNameAndNewKind(t *testing.T) {
	th := kusttest_test.MakeHarness(t)
	th.WriteF("base/deployment.yaml", `
apiVersion: v1
kind: Deployment
metadata:
  name: old-name
spec:
  template:
    spec:
      containers:
        - name: nginx
          image: nginx
`)
	th.WriteF("base/patch.yaml", `
apiVersion: v1
kind: StatefulSet
metadata:
  name: new-name
`)
	th.WriteK("base", `
resources:
- deployment.yaml
patches:
- path: patch.yaml
  target:
    kind: Deployment
  options:
    allowNameChange: true
    allowKindChange: true
`)
	th.WriteK("overlay", `
resources:
- ../base
patchesStrategicMerge:
- depPatch.yaml
`)
	th.WriteF("overlay/depPatch.yaml", `
apiVersion: v1
kind: Deployment
metadata:
  name: new-name
spec:
  replicas: 999
`)
	options := th.MakeDefaultOptions()
	assert.Error(t, th.RunWithErr("overlay", options))
}
func TestPatchOriginalNameAndNewKind ( t * testing . T ) { th := kusttest_test . MakeHarness ( t ) th . WriteF ( " " , `
apiVersion: v1
kind: Deployment
metadata:
  name: old-name
spec:
  template:
    spec:
      containers:
        - name: nginx
          image: nginx
` ) th . WriteF ( " " , `
apiVersion: v1
kind: StatefulSet
metadata:
  name: new-name
` ) th . WriteK ( " " , `
resources:
- deployment.yaml
patches:
- path: patch.yaml
  target:
    kind: Deployment
  options:
    allowNameChange: true
    allowKindChange: true
` ) th . WriteK ( " " , `
resources:
- ../base
patchesStrategicMerge:
- depPatch.yaml
` ) th . WriteF ( " " , `
apiVersion: v1
kind: Deployment
metadata:
  name: new-name
spec:
  replicas: 999
` ) options := th . MakeDefaultOptions ( ) assert . Error ( t , th . RunWithErr ( " " , options ) ) }
Use original name, but new kind
Should fail, even after #3280 is done, because this ID is invalid
Use original name but new kind Should fail even after #3280 is done because this ID is invalid
// depPatch cannot find target with kind `Deployment` and name `new-name` // because the resource never had this GVKN