github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/cmd/util/util_test.go (about)

     1  package util
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/rs/zerolog"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestDisabledGRPC(t *testing.T) {
    12  	s, err := (&GRPCServerConfig{Enabled: false}).Complete(zerolog.InfoLevel, nil)
    13  	require.NoError(t, err)
    14  	require.NoError(t, s.Listen(context.Background())())
    15  	require.True(t, s.Insecure())
    16  	s.GracefulStop()
    17  }
    18  
    19  func TestDisabledHTTP(t *testing.T) {
    20  	s, err := (&HTTPServerConfig{HTTPEnabled: false}).Complete(zerolog.InfoLevel, nil)
    21  	require.NoError(t, err)
    22  	require.NoError(t, s.ListenAndServe())
    23  	s.Close()
    24  }