Skip to content

Commit

Permalink
Merge pull request #423 from droot/running/fix-conversion-test-expect…
Browse files Browse the repository at this point in the history
…ations

🏃 fix expect statement in conversion tests to be idiomatic
  • Loading branch information
k8s-ci-robot committed May 13, 2019
2 parents dfc2508 + f956214 commit 29884f8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/webhook/conversion/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ var _ = Describe("Conversion Webhook", func() {
}

scheme = kscheme.Scheme
Expect(jobsapis.AddToScheme(scheme)).Should(Succeed())

Expect(webhook.InjectScheme(scheme)).Should(Succeed())
Expect(jobsapis.AddToScheme(scheme)).To(Succeed())
Expect(webhook.InjectScheme(scheme)).To(Succeed())

var err error
decoder, err = NewDecoder(scheme)
Expand All @@ -70,7 +69,7 @@ var _ = Describe("Conversion Webhook", func() {
Body: ioutil.NopCloser(bytes.NewReader(payload.Bytes())),
}
webhook.ServeHTTP(respRecorder, req)
Expect(json.NewDecoder(respRecorder.Result().Body).Decode(convReview)).Should(Succeed())
Expect(json.NewDecoder(respRecorder.Result().Body).Decode(convReview)).To(Succeed())
return convReview
}

Expand Down Expand Up @@ -146,7 +145,7 @@ var _ = Describe("Conversion Webhook", func() {

convReview := doRequest(convReq)
Expect(convReview.Response.Result.Status).To(Equal("Failure"))
Expect(convReview.Response.ConvertedObjects).Should(BeEmpty())
Expect(convReview.Response.ConvertedObjects).To(BeEmpty())
})

It("should return error when dest/src objects are of same type", func() {
Expand All @@ -167,7 +166,7 @@ var _ = Describe("Conversion Webhook", func() {

convReview := doRequest(convReq)
Expect(convReview.Response.Result.Status).To(Equal("Failure"))
Expect(convReview.Response.ConvertedObjects).Should(BeEmpty())
Expect(convReview.Response.ConvertedObjects).To(BeEmpty())
})

It("should return error when the API group does not have a hub defined", func() {
Expand Down Expand Up @@ -197,7 +196,7 @@ var _ = Describe("Conversion Webhook", func() {

convReview := doRequest(convReq)
Expect(convReview.Response.Result.Status).To(Equal("Failure"))
Expect(convReview.Response.ConvertedObjects).Should(BeEmpty())
Expect(convReview.Response.ConvertedObjects).To(BeEmpty())
})

})

0 comments on commit 29884f8

Please sign in to comment.