From e17a9b92d5352bc3e2ec163f0605ab7993be7e12 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 10 Jun 2022 17:54:15 +0200 Subject: [PATCH] fail gracefully --- integration/main_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/integration/main_test.go b/integration/main_test.go index a40682e..e0ec8f2 100644 --- a/integration/main_test.go +++ b/integration/main_test.go @@ -32,14 +32,18 @@ func TestMain(t *testing.T) { // test custom domain redirect resp, err := getTestHTTPSClient().Get("https://calciumdibromid.localhost.mock.directory:4430") assert.NoError(t, err) - assert.EqualValues(t, http.StatusTemporaryRedirect, resp.StatusCode) + if !assert.EqualValues(t, http.StatusTemporaryRedirect, resp.StatusCode) { + t.FailNow() + } assert.EqualValues(t, "https://www.cabr2.de/", resp.Header["Location"][0]) assert.EqualValues(t, 0, getSize(resp.Body)) // test get image resp, err = getTestHTTPSClient().Get("https://magiclike.localhost.mock.directory:4430/images/827679288a.jpg") assert.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.StatusCode) + if !assert.EqualValues(t, http.StatusOK, resp.StatusCode) { + t.FailNow() + } assert.EqualValues(t, "image/jpeg", resp.Header["Content-Type"][0]) assert.EqualValues(t, "124635", resp.Header["Content-Length"][0]) assert.EqualValues(t, 124635, getSize(resp.Body)) @@ -47,7 +51,9 @@ func TestMain(t *testing.T) { // specify branch resp, err = getTestHTTPSClient().Get("https://momar.localhost.mock.directory:4430/pag/@master/") assert.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.StatusCode) + if !assert.EqualValues(t, http.StatusOK, resp.StatusCode) { + t.FailNow() + } assert.EqualValues(t, "text/html; charset=utf-8", resp.Header["Content-Type"][0]) assert.True(t, getSize(resp.Body) > 1000) }