diff --git a/system_test/helpers.go b/system_test/helpers.go index 61e3f2ee..f41684ae 100644 --- a/system_test/helpers.go +++ b/system_test/helpers.go @@ -394,6 +394,9 @@ func (n *Node) postExecute(stmt string) (string, error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("execute endpoint returned: %s", resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return "", err @@ -412,6 +415,9 @@ func (n *Node) postExecuteQueued(stmt string, wait bool) (string, error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("execute endpoint (queued) returned: %s", resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return "", err @@ -431,6 +437,9 @@ func (n *Node) query(stmt, consistency string) (string, error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("query endpoint returned: %s", resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return "", err @@ -444,6 +453,9 @@ func (n *Node) postQuery(stmt string) (string, error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("query endpoint (POST) returned: %s", resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return "", err @@ -457,6 +469,9 @@ func (n *Node) postRequest(stmt string) (string, error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("request endpoint returned: %s", resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return "", err @@ -481,6 +496,9 @@ func PostExecuteStmtMulti(apiAddr string, stmts []string) (string, error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("execute endpoint returned: %s", resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return "", err