2021-10-18 12:43:17 +00:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2022-01-18 18:17:06 +00:00
|
|
|
"github.com/status-im/go-waku/tests"
|
2021-10-18 12:43:17 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStartAndStopMetricsServer(t *testing.T) {
|
2022-01-18 18:17:06 +00:00
|
|
|
server := NewMetricsServer("0.0.0.0", 9876, tests.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()
|
|
|
|
}
|