minimize test

This commit is contained in:
Karen Bradshaw
2019-05-14 12:35:30 -04:00
parent c724cb7178
commit 2aa7e30aff

View File

@@ -165,38 +165,18 @@ func TestJsonPatchJSONTransformer_UnHappyTransform(t *testing.T) {
}
func TestJsonPatchJSONTransformer_EmptyPatchFile(t *testing.T) {
rf := resource.NewFactory(
kunstruct.NewKunstructuredFactoryImpl())
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(``)
jpt, err := newPatchJson6902JSONTransformer(id, operations)
_, err := newPatchJson6902JSONTransformer(id, operations)
if err == nil {
t.Fatalf("unexpected error : %v", err)
if jpt != nil {
err = jpt.Transform(base)
}
}
if err != nil {
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)
}
}
}