From 2e669a7f22999b3d02e48385759baa37c79b2d57 Mon Sep 17 00:00:00 2001 From: jennybuckley Date: Fri, 23 Aug 2019 13:11:09 -0700 Subject: [PATCH] Fix failing test --- .../integration/apiserver/apply/apply_test.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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)