From 33818eef768e8cf5dd113fc132ed58f8007c89a1 Mon Sep 17 00:00:00 2001 From: Nick Z <2420177+nickzelei@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:08:26 -0800 Subject: [PATCH] fixes build errors after mege --- .../pkg/integration-test/integration-test.go | 10 ++++++---- backend/pkg/integration-test/mux.go | 20 +++++++++++-------- .../neosync/sync/sync_integration_test.go | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/backend/pkg/integration-test/integration-test.go b/backend/pkg/integration-test/integration-test.go index e1702faa0b..097c694163 100644 --- a/backend/pkg/integration-test/integration-test.go +++ b/backend/pkg/integration-test/integration-test.go @@ -115,25 +115,27 @@ func (s *NeosyncApiTestClient) Setup(ctx context.Context, t testing.TB) error { rootmux := http.NewServeMux() - ossUnauthLicensedMux, err := s.setupOssUnauthenticatedLicensedMux(ctx, pgcontainer) + logger := testutil.GetConcurrentTestLogger(t) + + ossUnauthLicensedMux, err := s.setupOssUnauthenticatedLicensedMux(ctx, pgcontainer, logger) if err != nil { return fmt.Errorf("unable to setup oss unauthenticated licensed mux: %w", err) } rootmux.Handle(openSourceUnauthenticatedLicensedPostfix+"/", http.StripPrefix(openSourceUnauthenticatedLicensedPostfix, ossUnauthLicensedMux)) - ossAuthLicensedMux, err := s.setupOssLicensedAuthMux(ctx, pgcontainer) + ossAuthLicensedMux, err := s.setupOssLicensedAuthMux(ctx, pgcontainer, logger) if err != nil { return fmt.Errorf("unable to setup oss authenticated licensed mux: %w", err) } rootmux.Handle(openSourceAuthenticatedLicensedPostfix+"/", http.StripPrefix(openSourceAuthenticatedLicensedPostfix, ossAuthLicensedMux)) - ossUnauthUnlicensedMux, err := s.setupOssUnlicensedMux(pgcontainer) + ossUnauthUnlicensedMux, err := s.setupOssUnlicensedMux(pgcontainer, logger) if err != nil { return fmt.Errorf("unable to setup oss unauthenticated unlicensed mux: %w", err) } rootmux.Handle(openSourceUnauthenticatedUnlicensedPostfix+"/", http.StripPrefix(openSourceUnauthenticatedUnlicensedPostfix, ossUnauthUnlicensedMux)) - neoCloudAuthdMux, err := s.setupNeoCloudMux(ctx, pgcontainer) + neoCloudAuthdMux, err := s.setupNeoCloudMux(ctx, pgcontainer, logger) if err != nil { return fmt.Errorf("unable to setup neo cloud authenticated mux: %w", err) } diff --git a/backend/pkg/integration-test/mux.go b/backend/pkg/integration-test/mux.go index d4ecce0631..62da17f2f0 100644 --- a/backend/pkg/integration-test/mux.go +++ b/backend/pkg/integration-test/mux.go @@ -3,6 +3,7 @@ package integrationtests_test import ( "context" "fmt" + "log/slog" "net/http" "connectrpc.com/connect" @@ -34,6 +35,7 @@ import ( awsmanager "github.com/nucleuscloud/neosync/internal/aws" "github.com/nucleuscloud/neosync/internal/billing" presidioapi "github.com/nucleuscloud/neosync/internal/ee/presidio" + neosynctypes "github.com/nucleuscloud/neosync/internal/neosync-types" "github.com/nucleuscloud/neosync/internal/testutil" tcpostgres "github.com/nucleuscloud/neosync/internal/testutil/testcontainers/postgres" ) @@ -72,7 +74,7 @@ const ( neoCloudAuthenticatedLicensedPostfix = "/neosynccloud-authenticated" ) -func (s *NeosyncApiTestClient) setupOssUnauthenticatedLicensedMux(ctx context.Context, pgcontainer *tcpostgres.PostgresTestContainer) (*http.ServeMux, error) { +func (s *NeosyncApiTestClient) setupOssUnauthenticatedLicensedMux(ctx context.Context, pgcontainer *tcpostgres.PostgresTestContainer, logger *slog.Logger) (*http.ServeMux, error) { isLicensed := true isAuthEnabled := false isNeosyncCloud := false @@ -80,10 +82,10 @@ func (s *NeosyncApiTestClient) setupOssUnauthenticatedLicensedMux(ctx context.Co if err != nil { return nil, fmt.Errorf("unable to get enforced rbac client: %w", err) } - return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, enforcedRbacClient) + return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, enforcedRbacClient, logger) } -func (s *NeosyncApiTestClient) setupOssLicensedAuthMux(ctx context.Context, pgcontainer *tcpostgres.PostgresTestContainer) (*http.ServeMux, error) { +func (s *NeosyncApiTestClient) setupOssLicensedAuthMux(ctx context.Context, pgcontainer *tcpostgres.PostgresTestContainer, logger *slog.Logger) (*http.ServeMux, error) { isLicensed := true isAuthEnabled := true isNeosyncCloud := false @@ -91,18 +93,18 @@ func (s *NeosyncApiTestClient) setupOssLicensedAuthMux(ctx context.Context, pgco if err != nil { return nil, fmt.Errorf("unable to get enforced rbac client: %w", err) } - return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, enforcedRbacClient) + return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, enforcedRbacClient, logger) } -func (s *NeosyncApiTestClient) setupOssUnlicensedMux(pgcontainer *tcpostgres.PostgresTestContainer) (*http.ServeMux, error) { +func (s *NeosyncApiTestClient) setupOssUnlicensedMux(pgcontainer *tcpostgres.PostgresTestContainer, logger *slog.Logger) (*http.ServeMux, error) { isLicensed := false isAuthEnabled := false isNeosyncCloud := false permissiveRbacClient := rbac.NewAllowAllClient() - return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, permissiveRbacClient) + return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, permissiveRbacClient, logger) } -func (s *NeosyncApiTestClient) setupNeoCloudMux(ctx context.Context, pgcontainer *tcpostgres.PostgresTestContainer) (*http.ServeMux, error) { +func (s *NeosyncApiTestClient) setupNeoCloudMux(ctx context.Context, pgcontainer *tcpostgres.PostgresTestContainer, logger *slog.Logger) (*http.ServeMux, error) { isLicensed := true isAuthEnabled := true isNeosyncCloud := true @@ -110,7 +112,7 @@ func (s *NeosyncApiTestClient) setupNeoCloudMux(ctx context.Context, pgcontainer if err != nil { return nil, fmt.Errorf("unable to get enforced rbac client: %w", err) } - return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, enforcedRbacClient) + return s.setupMux(pgcontainer, isAuthEnabled, isLicensed, isNeosyncCloud, enforcedRbacClient, logger) } func (s *NeosyncApiTestClient) setupMux( @@ -119,6 +121,7 @@ func (s *NeosyncApiTestClient) setupMux( isLicensed bool, isNeosyncCloud bool, rbacClient rbac.Interface, + logger *slog.Logger, ) (*http.ServeMux, error) { isPresidioEnabled := false if isLicensed || isNeosyncCloud { @@ -223,6 +226,7 @@ func (s *NeosyncApiTestClient) setupMux( mongoconnect.NewConnector(), sqlmanagerclient, neosync_gcp.NewManager(), + neosynctypes.NewTypeRegistry(logger), ) mux := http.NewServeMux() diff --git a/cli/internal/cmds/neosync/sync/sync_integration_test.go b/cli/internal/cmds/neosync/sync/sync_integration_test.go index d8a7d328f1..340599a82a 100644 --- a/cli/internal/cmds/neosync/sync/sync_integration_test.go +++ b/cli/internal/cmds/neosync/sync/sync_integration_test.go @@ -455,7 +455,7 @@ func Test_Sync(t *testing.T) { t.Fatal(err) } - sourceConn := tcneosyncapi.CreateDynamoDBConnection(ctx, t, neosyncApi.UnauthdClients.Connections, accountId, "dynamo-source", dynamo.Source.URL, dynamo.Source.Credentials) + sourceConn := tcneosyncapi.CreateDynamoDBConnection(ctx, t, neosyncApi.OSSUnauthenticatedLicensedClients.Connections(), accountId, "dynamo-source", dynamo.Source.URL, dynamo.Source.Credentials) t.Run("dynamodb_sync", func(t *testing.T) { t.Parallel()