Skip to content

Update simplified http response assertion #3142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions tests/suite/graceful_recovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,16 @@ func checkForFailingTraffic(teaURL, coffeeURL string) error {
return nil
}

func expectRequestToSucceed(appURL, address string, responseBodyMessage string) error {
func expectRequestToSucceed(appURL, address, responseBodyMessage string) error {
status, body, err := framework.Get(appURL, address, timeoutConfig.RequestTimeout, nil, nil)

if status != http.StatusOK {
return errors.New("http status was not 200")
if err != nil {
return err
}

if !strings.Contains(body, responseBodyMessage) {
return errors.New("expected response body to contain correct body message")
}
Expect(status).To(HaveHTTPStatus(http.StatusOK), "http status was not 200 but got %d", status)
Expect(body).To(HaveHTTPBody(ContainSubstring(responseBodyMessage)), "expected response body to contain correct body message but got: %s", responseBodyMessage)

return err
return nil
}

func expectRequestToFail(appURL, address string) error {
Expand Down