2021-06-01 10:51:35 +02:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
2023-10-23 21:40:10 +02:00
|
|
|
"codeberg.org/genofire/golang-lib/web/webtest"
|
2021-06-01 10:51:35 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMetricsLoaded(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
2021-07-19 17:59:08 +02:00
|
|
|
s, err := webtest.New(Register)
|
2021-06-28 13:59:27 +02:00
|
|
|
assert.NoError(err)
|
2021-06-25 12:22:19 +02:00
|
|
|
defer s.Close()
|
2021-06-01 10:51:35 +02:00
|
|
|
assert.NotNil(s)
|
|
|
|
|
|
|
|
// GET
|
2021-06-28 13:59:27 +02:00
|
|
|
err = s.Request(http.MethodGet, "/metrics", nil, http.StatusOK, nil)
|
2021-06-28 12:14:20 +02:00
|
|
|
assert.NoError(err)
|
2021-06-23 13:42:42 +02:00
|
|
|
|
|
|
|
UP = func() bool { return false }
|
|
|
|
|
|
|
|
// GET
|
2021-06-28 12:14:20 +02:00
|
|
|
err = s.Request(http.MethodGet, "/metrics", nil, http.StatusOK, nil)
|
|
|
|
assert.NoError(err)
|
2021-06-01 10:51:35 +02:00
|
|
|
}
|