2021-10-18 12:43:17 +00:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2022-11-09 19:53:01 +00:00
|
|
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
2021-10-18 12:43:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestStartAndStopMetricsServer(t *testing.T) {
|
2022-05-30 15:55:30 +00:00
|
|
|
server := NewMetricsServer("0.0.0.0", 9876, utils.Logger())
|
2021-10-18 12:43:17 +00:00
|
|
|
|
|
|
|
go func() {
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
err := server.Stop(context.Background())
|
|
|
|
require.NoError(t, err)
|
|
|
|
}()
|
|
|
|
|
|
|
|
server.Start()
|
|
|
|
}
|