From 70a8ac549f97e22f7ebc074559d1b19b3f65e657 Mon Sep 17 00:00:00 2001 From: WashingtonKK Date: Wed, 4 Dec 2024 19:24:53 +0300 Subject: [PATCH] remove redundant code Signed-off-by: WashingtonKK --- internal/server/grpc/grpc_test.go | 70 ------------------------------- 1 file changed, 70 deletions(-) diff --git a/internal/server/grpc/grpc_test.go b/internal/server/grpc/grpc_test.go index d9a8f9e1..85ff1a72 100644 --- a/internal/server/grpc/grpc_test.go +++ b/internal/server/grpc/grpc_test.go @@ -171,76 +171,6 @@ func TestServerStartWithMTLS(t *testing.T) { assert.Contains(t, logContent, "TestServer service gRPC server listening at localhost:0 with TLS") } -func TestServerStartWithmTLSFile(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - - cert, key, err := generateSelfSignedCert() - assert.NoError(t, err) - - certFile, err := os.CreateTemp("", "cert*.pem") - assert.NoError(t, err) - - keyFile, err := os.CreateTemp("", "key*.pem") - assert.NoError(t, err) - - t.Cleanup(func() { - os.Remove(certFile.Name()) - os.Remove(keyFile.Name()) - }) - - _, err = certFile.Write(cert) - assert.NoError(t, err) - - _, err = keyFile.Write(key) - assert.NoError(t, err) - - err = certFile.Close() - assert.NoError(t, err) - err = keyFile.Close() - assert.NoError(t, err) - - config := server.AgentConfig{ - ServerConfig: server.ServerConfig{ - BaseConfig: server.BaseConfig{ - Host: "localhost", - Port: "0", - CertFile: certFile.Name(), - KeyFile: keyFile.Name(), - ServerCAFile: certFile.Name(), - ClientCAFile: certFile.Name(), - }, - }, - } - - logBuffer := &ThreadSafeBuffer{} - logger := slog.New(slog.NewTextHandler(logBuffer, &slog.HandlerOptions{Level: slog.LevelDebug})) - qp := new(mocks.QuoteProvider) - authSvc := new(authmocks.Authenticator) - - srv := New(ctx, cancel, "TestServer", config, func(srv *grpc.Server) {}, logger, qp, authSvc) - - var wg sync.WaitGroup - wg.Add(1) - - go func() { - wg.Done() - err := srv.Start() - assert.NoError(t, err) - }() - - wg.Wait() - - time.Sleep(200 * time.Millisecond) - - cancel() - - time.Sleep(200 * time.Millisecond) - - logContent := logBuffer.String() - fmt.Println(logContent) - assert.Contains(t, logContent, "TestServer service gRPC server listening at localhost:0 with TLS") -} - func TestServerStop(t *testing.T) { ctx, cancel := context.WithCancel(context.Background())