mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
minimize test
This commit is contained in:
@@ -165,38 +165,18 @@ func TestJsonPatchJSONTransformer_UnHappyTransform(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJsonPatchJSONTransformer_EmptyPatchFile(t *testing.T) {
|
func TestJsonPatchJSONTransformer_EmptyPatchFile(t *testing.T) {
|
||||||
rf := resource.NewFactory(
|
|
||||||
kunstruct.NewKunstructuredFactoryImpl())
|
|
||||||
id := resid.NewResId(deploy, "deploy1")
|
id := resid.NewResId(deploy, "deploy1")
|
||||||
base := resmap.ResMap{
|
|
||||||
id: rf.FromMap(
|
|
||||||
map[string]interface{}{
|
|
||||||
"apiVersion": "apps/v1",
|
|
||||||
"kind": "Deployment",
|
|
||||||
"metadata": map[string]interface{}{
|
|
||||||
"name": "deploy1",
|
|
||||||
},
|
|
||||||
"spec": map[string]interface{}{
|
|
||||||
"template": map[string]interface{}{},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
|
|
||||||
operations := []byte(``)
|
operations := []byte(``)
|
||||||
|
|
||||||
jpt, err := newPatchJson6902JSONTransformer(id, operations)
|
_, err := newPatchJson6902JSONTransformer(id, operations)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("unexpected error : %v", err)
|
t.Fatalf("unexpected error : %v", err)
|
||||||
|
|
||||||
if jpt != nil {
|
|
||||||
err = jpt.Transform(base)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !strings.HasPrefix(err.Error(), "json patch file is empty") {
|
if !strings.HasPrefix(err.Error(), "json patch file is empty") {
|
||||||
t.Fatalf("expected error didn't happen, but got %v", err)
|
t.Fatalf("expected %s, but got %v", "json patch file is empty", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user