func exitWithResult(result interface{}) { fmt.Println(bosh.BuildResultResponse(result, responseLogBuffer.String())) responseLogBuffer.Reset() os.Exit(0) }
err := json.Unmarshal(errRespBytes, &targetResponse) Expect(err).ToNot(HaveOccurred()) Expect(targetResponse.Result).To(BeNil()) Expect(targetResponse.Log).To(BeEmpty()) targetResponseErr := targetResponse.Error Expect(targetResponseErr.Type).To(Equal(bosh.NotImplementedErrorType)) Expect(targetResponseErr.Message).To(Equal(testErrMsg)) Expect(targetResponseErr.Retryable).To(BeFalse()) }) }) Describe("exiting successfully", func() { It("wraps the response in a CpiResponse", func() { resultMsg := "successful result" resultLog := "this is a log" resultResp := bosh.BuildResultResponse(resultMsg, resultLog) resultRespBytes := []byte(resultResp) targetResponse := bosh.CpiResponse{} err := json.Unmarshal(resultRespBytes, &targetResponse) Expect(err).ToNot(HaveOccurred()) Expect(targetResponse.Result).To(Equal(resultMsg)) Expect(targetResponse.Log).To(Equal(resultLog)) Expect(targetResponse.Error).To(BeNil()) }) }) })