2021-10-18 12:43:17 +00:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2022-05-06 19:29:31 +00:00
|
|
|
"github.com/status-im/go-waku/waku/v2/utils"
|
2021-10-18 12:43:17 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
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()
|
|
|
|
}
|