Skip to content

Commit

Permalink
CLOUDP-266544: Fix internal deployemnt translation naming (#1781)
Browse files Browse the repository at this point in the history
Signed-off-by: jose.vazquez <[email protected]>
  • Loading branch information
josvazg authored Aug 23, 2024
1 parent b0d9a43 commit 14dfdbe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions internal/translation/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ func NewAtlasDeploymentsService(ctx context.Context, provider atlas.Provider, se
if err != nil {
return nil, fmt.Errorf("failed to create versioned client: %w", err)
}
return NewProductionAtlasDeployments(client.ClustersApi, client.ServerlessInstancesApi, isGov), nil
return NewAtlasDeployments(client.ClustersApi, client.ServerlessInstancesApi, isGov), nil
}

func NewProductionAtlasDeployments(clusterService admin.ClustersApi, serverlessAPI admin.ServerlessInstancesApi, isGov bool) *ProductionAtlasDeployments {
func NewAtlasDeployments(clusterService admin.ClustersApi, serverlessAPI admin.ServerlessInstancesApi, isGov bool) *ProductionAtlasDeployments {
return &ProductionAtlasDeployments{clustersAPI: clusterService, serverlessAPI: serverlessAPI, isGov: isGov}
}

Expand Down
14 changes: 7 additions & 7 deletions internal/translation/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func TestClusterExists(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, tt.gov)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, tt.gov)

result, err := service.ClusterExists(context.Background(), tt.deployment.GetProjectID(), tt.deployment.GetName())
require.Equal(t, tt.err, err)
Expand Down Expand Up @@ -342,7 +342,7 @@ func TestGetDeployment(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)

result, err := service.GetDeployment(context.Background(), tt.deployment.GetProjectID(), tt.deployment.GetName())
require.Equal(t, tt.err, err)
Expand Down Expand Up @@ -431,7 +431,7 @@ func TestCreateDeployment(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)

result, err := service.CreateDeployment(context.Background(), tt.deployment)
require.Equal(t, tt.err, err)
Expand Down Expand Up @@ -520,7 +520,7 @@ func TestUpdateDeployment(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)

result, err := service.UpdateDeployment(context.Background(), tt.deployment)
require.Equal(t, tt.err, err)
Expand Down Expand Up @@ -601,7 +601,7 @@ func TestDeleteDeployment(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)

err := service.DeleteDeployment(context.Background(), tt.deployment)
require.Equal(t, tt.err, err)
Expand Down Expand Up @@ -708,7 +708,7 @@ func TestClusterWithProcessArgs(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)

cluster := tt.deployment.(*Cluster)
err := service.ClusterWithProcessArgs(context.Background(), cluster)
Expand Down Expand Up @@ -836,7 +836,7 @@ func TestUpdateProcessArgs(t *testing.T) {
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
clusterAPI, serverlessInstanceAPI := tt.apiMocker()
service := NewProductionAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)
service := NewAtlasDeployments(clusterAPI, serverlessInstanceAPI, false)

cluster := tt.deployment.(*Cluster)
err := service.UpdateProcessArgs(context.Background(), cluster)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *AtlasDeploymentReconciler) Reconcile(context context.Context, req ctrl.
return result.ReconcileResult(), nil
}
ctx.SdkClient = atlasSdkClient
r.deploymentService = deployment.NewProductionAtlasDeployments(atlasSdkClient.ClustersApi, atlasSdkClient.ServerlessInstancesApi, r.AtlasProvider.IsCloudGov())
r.deploymentService = deployment.NewAtlasDeployments(atlasSdkClient.ClustersApi, atlasSdkClient.ServerlessInstancesApi, r.AtlasProvider.IsCloudGov())

deploymentInAKO := deployment.NewDeployment(project.ID(), atlasDeployment)
deploymentInAtlas, err := r.deploymentService.GetDeployment(ctx.Context, project.ID(), atlasDeployment.GetDeploymentName())
Expand Down
2 changes: 1 addition & 1 deletion test/int/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var _ = Describe("AtlasDeployment", Label("int", "AtlasDeployment", "deployment-
BeforeEach(func() {
prepareControllers(false)

deploymentService = deployment.NewProductionAtlasDeployments(atlasClient.ClustersApi, atlasClient.ServerlessInstancesApi, false)
deploymentService = deployment.NewAtlasDeployments(atlasClient.ClustersApi, atlasClient.ServerlessInstancesApi, false)
createdDeployment = &akov2.AtlasDeployment{}

manualDeletion = false
Expand Down

0 comments on commit 14dfdbe

Please sign in to comment.