Skip to content

Commit

Permalink
Use apply to create objects in TestApplyStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt authored and kevindelgado committed Jan 29, 2021
1 parent 0f6873c commit 46699bf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/integration/apiserver/apply/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,17 @@ func TestApplyStatus(t *testing.T) {
namespace = ""
}
name := newObj.GetName()

// etcd test stub data doesn't contain apiVersion/kind (!), but apply requires it
newObj.SetGroupVersionKind(mapping.GroupVersionKind)
createData, err := json.Marshal(newObj.Object)
if err != nil {
t.Fatal(err)
}

rsc := dynamicClient.Resource(mapping.Resource).Namespace(namespace)
_, err := rsc.Create(context.TODO(), &newObj, metav1.CreateOptions{FieldManager: "create_test"})
// apply to create
_, err = rsc.Patch(context.TODO(), name, types.ApplyPatchType, []byte(createData), metav1.PatchOptions{FieldManager: "create_test"})
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 46699bf

Please sign in to comment.