rename prommetric to prometheous, add unit tests

This commit is contained in:
kevin
2020-09-27 16:14:16 +08:00
parent 015716d1b5
commit a958400595
11 changed files with 119 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
package handler
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPromMetricHandler(t *testing.T) {
promMetricHandler := PrometheousHandler("/user/login")
handler := promMetricHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))
req := httptest.NewRequest(http.MethodGet, "http://localhost", nil)
resp := httptest.NewRecorder()
handler.ServeHTTP(resp, req)
assert.Equal(t, http.StatusOK, resp.Code)
}