diff --git a/test/integration/apiserver/apply/apply_test.go b/test/integration/apiserver/apply/apply_test.go index 95abb4ec42b..4df47e5f2f2 100644 --- a/test/integration/apiserver/apply/apply_test.go +++ b/test/integration/apiserver/apply/apply_test.go @@ -180,7 +180,7 @@ func TestNoOpUpdateSameResourceVersion(t *testing.T) { } }`) - _, err := client.CoreV1().RESTClient().Patch(types.ApplyPatchType). + o, err := client.CoreV1().RESTClient().Patch(types.ApplyPatchType). Namespace("default"). Param("fieldManager", "apply_test"). Resource(podResource). @@ -192,6 +192,23 @@ func TestNoOpUpdateSameResourceVersion(t *testing.T) { t.Fatalf("Failed to create object: %v", err) } + // Need to update once for some reason + // TODO: Remove this once possible + b, err := json.MarshalIndent(o, "\t", "\t") + if err != nil { + t.Fatalf("Failed to marshal created object: %v", err) + } + _, err = client.CoreV1().RESTClient().Put(). + Namespace("default"). + Resource(podResource). + Name(podName). + Body(b). + Do(). + Get() + if err != nil { + t.Fatalf("Failed to apply first no-op update: %v", err) + } + // Sleep for one second to make sure that the times of each update operation is different. time.Sleep(1 * time.Second)