mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-30 10:39:08 +02:00
[management,signal,proxy] add pyroscope profiling (#7536)
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.opentelemetry.io/otel/metric/noop"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/connectivity"
|
||||
|
||||
"github.com/netbirdio/netbird/proxy/internal/auth"
|
||||
proxymetrics "github.com/netbirdio/netbird/proxy/internal/metrics"
|
||||
@@ -106,6 +107,25 @@ func TestStartFailsWithoutManagement(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "already started", "error must explain why the call was rejected")
|
||||
}
|
||||
|
||||
func TestStartFailureReleasesManagementConnection(t *testing.T) {
|
||||
srv := New(t.Context(), Config{
|
||||
Logger: quietLifecycleLogger(),
|
||||
ListenAddr: "127.0.0.1:0",
|
||||
ManagementAddress: "https://127.0.0.1:1",
|
||||
CertificateDirectory: t.TempDir(),
|
||||
CertificateFile: "missing.crt",
|
||||
CertificateKeyFile: "missing.key",
|
||||
})
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
err := srv.Start(ctx)
|
||||
require.Error(t, err, "Start must fail on the missing certificate")
|
||||
require.NotNil(t, srv.mgmtConn, "the management connection is created before the certificate step")
|
||||
assert.Equal(t, connectivity.Shutdown, srv.mgmtConn.GetState(), "a failed Start must close the management connection it opened")
|
||||
}
|
||||
|
||||
func TestStopIsIdempotent(t *testing.T) {
|
||||
srv := &Server{
|
||||
Logger: quietLifecycleLogger(),
|
||||
|
||||
Reference in New Issue
Block a user