mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Maintain resources in order loaded.
This commit is contained in:
@@ -185,7 +185,7 @@ func TestNewPatchJson6902FactoryMulti(t *testing.T) {
|
||||
}
|
||||
|
||||
id := resid.NewResId(gvk.FromKind("foo"), "some-name")
|
||||
base := resmap.ResMap{
|
||||
base := resmap.FromMap(map[resid.ResId]*resource.Resource{
|
||||
id: rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"kind": "foo",
|
||||
@@ -210,8 +210,8 @@ func TestNewPatchJson6902FactoryMulti(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
})
|
||||
expected := resmap.FromMap(map[resid.ResId]*resource.Resource{
|
||||
id: rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"kind": "foo",
|
||||
@@ -242,7 +242,7 @@ func TestNewPatchJson6902FactoryMulti(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
})
|
||||
err = tr.Transform(base)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error : %v", err)
|
||||
@@ -299,7 +299,7 @@ func TestNewPatchJson6902FactoryMultiConflict(t *testing.T) {
|
||||
}
|
||||
|
||||
id := resid.NewResId(gvk.FromKind("foo"), "some-name")
|
||||
base := resmap.ResMap{
|
||||
base := resmap.FromMap(map[resid.ResId]*resource.Resource{
|
||||
id: rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"kind": "foo",
|
||||
@@ -324,7 +324,7 @@ func TestNewPatchJson6902FactoryMultiConflict(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
err = tr.Transform(base)
|
||||
if err == nil {
|
||||
|
||||
@@ -109,5 +109,5 @@ func (t *patchJson6902JSONTransformer) findTargetObj(
|
||||
"found multiple targets %v matching %v for json patch",
|
||||
matched, t.target)
|
||||
}
|
||||
return m[matched[0]], nil
|
||||
return m.GetById(matched[0]), nil
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func TestJsonPatchJSONTransformer_Transform(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
kunstruct.NewKunstructuredFactoryImpl())
|
||||
id := resid.NewResId(deploy, "deploy1")
|
||||
base := resmap.ResMap{
|
||||
base := resmap.FromMap(map[resid.ResId]*resource.Resource{
|
||||
id: rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
@@ -60,7 +60,7 @@ func TestJsonPatchJSONTransformer_Transform(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
operations := []byte(`[
|
||||
{"op": "replace", "path": "/spec/template/spec/containers/0/name", "value": "my-nginx"},
|
||||
@@ -68,7 +68,7 @@ func TestJsonPatchJSONTransformer_Transform(t *testing.T) {
|
||||
{"op": "add", "path": "/spec/template/spec/containers/0/command", "value": ["arg1", "arg2", "arg3"]}
|
||||
]`)
|
||||
|
||||
expected := resmap.ResMap{
|
||||
expected := resmap.FromMap(map[resid.ResId]*resource.Resource{
|
||||
id: rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
@@ -100,7 +100,7 @@ func TestJsonPatchJSONTransformer_Transform(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
})
|
||||
jpt, err := newPatchJson6902JSONTransformer(id, operations)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error : %v", err)
|
||||
@@ -119,7 +119,7 @@ func TestJsonPatchJSONTransformer_UnHappyTransform(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
kunstruct.NewKunstructuredFactoryImpl())
|
||||
id := resid.NewResId(deploy, "deploy1")
|
||||
base := resmap.ResMap{
|
||||
base := resmap.FromMap(map[resid.ResId]*resource.Resource{
|
||||
id: rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
@@ -145,7 +145,7 @@ func TestJsonPatchJSONTransformer_UnHappyTransform(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
operations := []byte(`[
|
||||
{"op": "add", "path": "/spec/template/spec/containers/0/command/", "value": ["arg1", "arg2", "arg3"]}
|
||||
|
||||
Reference in New Issue
Block a user