diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-10-11 05:54:27 +0300 |
---|---|---|
committer | Vladimir Shushlin <v.shushlin@gmail.com> | 2021-10-14 14:32:42 +0300 |
commit | c1dd17cd84be6388d0291014254503b651737a23 (patch) | |
tree | bb578b0b699d5e6397836a6d15bdb0bb36ff7c46 /app_test.go | |
parent | 98e38acc90217a7a5bdb23b048c10d47d6dee1f7 (diff) |
test: assert metric counter
Diffstat (limited to 'app_test.go')
-rw-r--r-- | app_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app_test.go b/app_test.go index 6da1e4fd..db4d9d67 100644 --- a/app_test.go +++ b/app_test.go @@ -9,11 +9,13 @@ import ( "testing" "time" + "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitlab-pages/internal/config" "gitlab.com/gitlab-org/gitlab-pages/internal/request" "gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab" + "gitlab.com/gitlab-org/gitlab-pages/metrics" ) func Test_setRequestScheme(t *testing.T) { @@ -142,4 +144,6 @@ func TestHandlePanicMiddleware(t *testing.T) { res.Body.Close() require.Equal(t, http.StatusInternalServerError, res.StatusCode) + counterCount := testutil.ToFloat64(metrics.PanicRecoveredCount) + require.Equal(t, float64(1), counterCount, "metric not updated") } |