Skip to content

Commit 2a0199d

Browse files
committed
update unittesst
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
1 parent 5a7db5c commit 2a0199d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/client/client_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4158,7 +4158,7 @@ var _ = Describe("Patch", func() {
41584158
Expect(err).NotTo(HaveOccurred())
41594159

41604160
By("returning a patch with data containing the annotation change and the resourceVersion change")
4161-
Expect(data).To(Equal(fmt.Appendf(nil, `{"metadata":{"annotations":{"%s":"%s"},"resourceVersion":"%s"}}`, annotationKey, annotationValue, cm.ResourceVersion)))
4161+
Expect(data).To(Equal([]byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"%s"},"resourceVersion":"%s"}}`, annotationKey, annotationValue, cm.ResourceVersion))))
41624162
})
41634163
})
41644164

@@ -4234,9 +4234,9 @@ var _ = Describe("Patch", func() {
42344234
Expect(err).NotTo(HaveOccurred())
42354235

42364236
By("returning a patch with data containing the image change and the resourceVersion change")
4237-
Expect(data).To(Equal(fmt.Appendf(nil, `{"metadata":{"resourceVersion":"%s"},`+
4237+
Expect(data).To(Equal([]byte(fmt.Sprintf(`{"metadata":{"resourceVersion":"%s"},`+
42384238
`"spec":{"template":{"spec":{"$setElementOrder/containers":[{"name":"main"},{"name":"sidecar"}],"containers":[{"image":"foo:v2","name":"main"}]}}}}`,
4239-
dep.ResourceVersion)))
4239+
dep.ResourceVersion))))
42404240
})
42414241
})
42424242
})

pkg/client/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func ExampleClient_patchStatus() {
238238
Version: "v1beta1",
239239
Kind: "CronJob",
240240
})
241-
patch := fmt.Appendf(nil, `{"status":{"lastScheduleTime":"%s"}}`, time.Now().Format(time.RFC3339))
241+
patch := []byte(fmt.Sprintf(`{"status":{"lastScheduleTime":"%s"}}`, time.Now().Format(time.RFC3339)))
242242
_ = c.Status().Patch(context.Background(), u, client.RawPatch(types.MergePatchType, patch))
243243
}
244244

pkg/client/fake/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ var _ = Describe("Fake client", func() {
17191719
cl := NewClientBuilder().WithObjects(obj).Build()
17201720
objOriginal := obj.DeepCopy()
17211721

1722-
patch := fmt.Appendf(nil, `{"spec":{"replicas":%d}}`, 2)
1722+
patch := []byte(fmt.Sprintf(`{"spec":{"replicas":%d}}`, 2))
17231723
Expect(cl.SubResource("scale").Patch(ctx, obj, client.RawPatch(types.MergePatchType, patch))).NotTo(HaveOccurred())
17241724

17251725
actual := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: obj.Name}}

0 commit comments

Comments
 (0)