Skip to content

Commit

Permalink
fixes build errors after mege
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei committed Dec 23, 2024
1 parent bfe3cf9 commit 33818ee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
10 changes: 6 additions & 4 deletions backend/pkg/integration-test/integration-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
20 changes: 12 additions & 8 deletions backend/pkg/integration-test/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package integrationtests_test
import (
"context"
"fmt"
"log/slog"
"net/http"

"connectrpc.com/connect"
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -72,45 +74,45 @@ 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
enforcedRbacClient, err := s.getEnforcedRbacClient(ctx, 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) 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
enforcedRbacClient, err := s.getEnforcedRbacClient(ctx, 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) 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
enforcedRbacClient, err := s.getEnforcedRbacClient(ctx, 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(
Expand All @@ -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 {
Expand Down Expand Up @@ -223,6 +226,7 @@ func (s *NeosyncApiTestClient) setupMux(
mongoconnect.NewConnector(),
sqlmanagerclient,
neosync_gcp.NewManager(),
neosynctypes.NewTypeRegistry(logger),
)

mux := http.NewServeMux()
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cmds/neosync/sync/sync_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 33818ee

Please sign in to comment.