@@ -556,6 +556,95 @@ func TestHandleServerlessInstance(t *testing.T) {
556556 WithMessageRegexp ("unable to retrieve list of serverless private endpoints from Atlas: failed to list private endpoints" ),
557557 },
558558 },
559+ "serverless flex instance fails when private endpoints are set" : {
560+ atlasDeployment : & akov2.AtlasDeployment {
561+ ObjectMeta : metav1.ObjectMeta {
562+ Name : "instance0" ,
563+ Namespace : "default" ,
564+ },
565+ Spec : akov2.AtlasDeploymentSpec {
566+ ProjectDualReference : akov2.ProjectDualReference {
567+ ProjectRef : & common.ResourceRefNamespaced {
568+ Name : "my-project" ,
569+ },
570+ },
571+ ServerlessSpec : & akov2.ServerlessSpec {
572+ Name : "instance0" ,
573+ ProviderSettings : & akov2.ServerlessProviderSettingsSpec {
574+ ProviderName : provider .ProviderServerless ,
575+ BackingProviderName : "AWS" ,
576+ RegionName : "us-east-1" ,
577+ },
578+ Tags : []* akov2.TagSpec {
579+ {
580+ Key : "test" ,
581+ Value : "e2e" ,
582+ },
583+ },
584+ BackupOptions : akov2.ServerlessBackupOptions {
585+ ServerlessContinuousBackupEnabled : false ,
586+ },
587+ TerminationProtectionEnabled : true ,
588+ PrivateEndpoints : []akov2.ServerlessPrivateEndpoint {
589+ {
590+ Name : "spe1" ,
591+ CloudProviderEndpointID : "arn-12345" ,
592+ },
593+ },
594+ },
595+ },
596+ },
597+ deploymentInAtlas : & deployment.Serverless {
598+ ProjectID : "project-id" ,
599+ State : "IDLE" ,
600+ ServerlessSpec : & akov2.ServerlessSpec {
601+ Name : "instance0" ,
602+ ProviderSettings : & akov2.ServerlessProviderSettingsSpec {
603+ ProviderName : provider .ProviderServerless ,
604+ BackingProviderName : "AWS" ,
605+ RegionName : "us-east-1" ,
606+ },
607+ Tags : []* akov2.TagSpec {
608+ {
609+ Key : "test" ,
610+ Value : "e2e" ,
611+ },
612+ },
613+ BackupOptions : akov2.ServerlessBackupOptions {
614+ ServerlessContinuousBackupEnabled : false ,
615+ },
616+ TerminationProtectionEnabled : true ,
617+ },
618+ },
619+ deploymentService : func () deployment.AtlasDeploymentsService {
620+ service := translation .NewAtlasDeploymentsServiceMock (t )
621+
622+ return service
623+ },
624+ sdkMock : func () * admin.APIClient {
625+ mockError := & admin.GenericOpenAPIError {}
626+ model := * admin .NewApiError ()
627+ model .SetErrorCode ("NOT_SERVERLESS_TENANT_CLUSTER" )
628+ mockError .SetModel (model )
629+
630+ speClient := mockadmin .NewServerlessPrivateEndpointsApi (t )
631+ speClient .EXPECT ().ListServerlessPrivateEndpoints (context .Background (), "project-id" , "instance0" ).
632+ Return (admin.ListServerlessPrivateEndpointsApiRequest {ApiService : speClient })
633+ speClient .EXPECT ().ListServerlessPrivateEndpointsExecute (mock .AnythingOfType ("admin.ListServerlessPrivateEndpointsApiRequest" )).
634+ Return (nil , & http.Response {}, mockError )
635+
636+ return & admin.APIClient {ServerlessPrivateEndpointsApi : speClient }
637+ },
638+ expectedResult : ctrl.Result {RequeueAfter : workflow .DefaultRetry },
639+ expectedConditions : []api.Condition {
640+ api .FalseCondition (api .ServerlessPrivateEndpointReadyType ).
641+ WithReason (string (workflow .ServerlessPrivateEndpointFailed )).
642+ WithMessageRegexp ("serverless private endpoints are not supported: " ),
643+ api .FalseCondition (api .DeploymentReadyType ).
644+ WithReason (string (workflow .ServerlessPrivateEndpointFailed )).
645+ WithMessageRegexp ("serverless private endpoints are not supported: " ),
646+ },
647+ },
559648 "serverless instance is updating when private endpoints are in progress" : {
560649 atlasDeployment : & akov2.AtlasDeployment {
561650 ObjectMeta : metav1.ObjectMeta {
0 commit comments