@@ -117,7 +117,7 @@ void testAddDualPoolWithBootDiskSize(MockServerClient mock) {
117117 );
118118
119119 mock .when (
120- request ().withMethod ("POST" ).withPath ("/compute-envs" ).withBody (JsonBody .json ("{\" computeEnv\" :{\" name\" :\" azure\" ,\" platform\" :\" azure-batch\" ,\" config\" :{\" workDir\" :\" az://nextflow-ci/jordeu\" ,\" region\" :\" europe\" ,\" forge\" :{\" disposeOnDeletion\" :true,\" bootDiskSizeGB\" :100,\" headPool\" :{\" bootDiskSizeGB\" :50},\" workerPool\" :{\" bootDiskSizeGB\" :200}}},\" credentialsId\" :\" 57Ic6reczFn78H1DTaaXkp\" }}" )), exactly (1 )
120+ request ().withMethod ("POST" ).withPath ("/compute-envs" ).withBody (JsonBody .json ("{\" computeEnv\" :{\" name\" :\" azure\" ,\" platform\" :\" azure-batch\" ,\" config\" :{\" workDir\" :\" az://nextflow-ci/jordeu\" ,\" region\" :\" europe\" ,\" forge\" :{\" disposeOnDeletion\" :true,\" bootDiskSizeGB\" :100,\" headPool\" :{\" autoScale \" :true, \" bootDiskSizeGB\" :50},\" workerPool\" :{\" autoScale \" :true, \" bootDiskSizeGB\" :200}}},\" credentialsId\" :\" 57Ic6reczFn78H1DTaaXkp\" }}" )), exactly (1 )
121121 ).respond (
122122 response ().withStatusCode (200 ).withBody ("{\" computeEnvId\" :\" isnEDBLvHDAIteOEF44ow\" }" ).withContentType (MediaType .APPLICATION_JSON )
123123 );
@@ -129,4 +129,52 @@ void testAddDualPoolWithBootDiskSize(MockServerClient mock) {
129129 assertEquals (0 , out .exitCode );
130130 }
131131
132+ @ Test
133+ void testAddDualPoolEnablesAutoscalingByDefault (MockServerClient mock ) {
134+
135+ mock .reset ();
136+
137+ mock .when (
138+ request ().withMethod ("GET" ).withPath ("/credentials" ).withQueryStringParameter ("platformId" , "azure-batch" ), exactly (1 )
139+ ).respond (
140+ response ().withStatusCode (200 ).withBody ("{\" credentials\" :[{\" id\" :\" 57Ic6reczFn78H1DTaaXkp\" ,\" name\" :\" azure\" ,\" description\" :null,\" discriminator\" :\" azure\" ,\" baseUrl\" :null,\" category\" :null,\" deleted\" :null,\" lastUsed\" :null,\" dateCreated\" :\" 2021-09-07T13:50:21Z\" ,\" lastUpdated\" :\" 2021-09-07T13:50:21Z\" }]}" ).withContentType (MediaType .APPLICATION_JSON )
141+ );
142+
143+ mock .when (
144+ request ().withMethod ("POST" ).withPath ("/compute-envs" ).withBody (JsonBody .json ("{\" computeEnv\" :{\" name\" :\" azure\" ,\" platform\" :\" azure-batch\" ,\" config\" :{\" workDir\" :\" az://nextflow-ci/jordeu\" ,\" region\" :\" europe\" ,\" forge\" :{\" disposeOnDeletion\" :true,\" headPool\" :{\" vmCount\" :8,\" autoScale\" :true},\" workerPool\" :{\" vmCount\" :32,\" autoScale\" :true}}},\" credentialsId\" :\" 57Ic6reczFn78H1DTaaXkp\" }}" )), exactly (1 )
145+ ).respond (
146+ response ().withStatusCode (200 ).withBody ("{\" computeEnvId\" :\" isnEDBLvHDAIteOEF44ow\" }" ).withContentType (MediaType .APPLICATION_JSON )
147+ );
148+
149+ ExecOut out = exec (mock , "compute-envs" , "add" , "azure-batch" , "forge" , "-n" , "azure" , "-l" , "europe" , "--work-dir" , "az://nextflow-ci/jordeu" , "--dual-pool" , "--head-vm-count" , "8" , "--worker-vm-count" , "32" );
150+
151+ assertEquals ("" , out .stdErr );
152+ assertEquals (new ComputeEnvAdded ("azure-batch" , "isnEDBLvHDAIteOEF44ow" , "azure" , null , USER_WORKSPACE_NAME ).toString (), out .stdOut );
153+ assertEquals (0 , out .exitCode );
154+ }
155+
156+ @ Test
157+ void testAddDualPoolDisablesAutoscalingExplicitly (MockServerClient mock ) {
158+
159+ mock .reset ();
160+
161+ mock .when (
162+ request ().withMethod ("GET" ).withPath ("/credentials" ).withQueryStringParameter ("platformId" , "azure-batch" ), exactly (1 )
163+ ).respond (
164+ response ().withStatusCode (200 ).withBody ("{\" credentials\" :[{\" id\" :\" 57Ic6reczFn78H1DTaaXkp\" ,\" name\" :\" azure\" ,\" description\" :null,\" discriminator\" :\" azure\" ,\" baseUrl\" :null,\" category\" :null,\" deleted\" :null,\" lastUsed\" :null,\" dateCreated\" :\" 2021-09-07T13:50:21Z\" ,\" lastUpdated\" :\" 2021-09-07T13:50:21Z\" }]}" ).withContentType (MediaType .APPLICATION_JSON )
165+ );
166+
167+ mock .when (
168+ request ().withMethod ("POST" ).withPath ("/compute-envs" ).withBody (JsonBody .json ("{\" computeEnv\" :{\" name\" :\" azure\" ,\" platform\" :\" azure-batch\" ,\" config\" :{\" workDir\" :\" az://nextflow-ci/jordeu\" ,\" region\" :\" europe\" ,\" forge\" :{\" disposeOnDeletion\" :true,\" headPool\" :{\" autoScale\" :false},\" workerPool\" :{\" autoScale\" :false}}},\" credentialsId\" :\" 57Ic6reczFn78H1DTaaXkp\" }}" )), exactly (1 )
169+ ).respond (
170+ response ().withStatusCode (200 ).withBody ("{\" computeEnvId\" :\" isnEDBLvHDAIteOEF44ow\" }" ).withContentType (MediaType .APPLICATION_JSON )
171+ );
172+
173+ ExecOut out = exec (mock , "compute-envs" , "add" , "azure-batch" , "forge" , "-n" , "azure" , "-l" , "europe" , "--work-dir" , "az://nextflow-ci/jordeu" , "--dual-pool" , "--head-no-auto-scale" , "--worker-no-auto-scale" );
174+
175+ assertEquals ("" , out .stdErr );
176+ assertEquals (new ComputeEnvAdded ("azure-batch" , "isnEDBLvHDAIteOEF44ow" , "azure" , null , USER_WORKSPACE_NAME ).toString (), out .stdOut );
177+ assertEquals (0 , out .exitCode );
178+ }
179+
132180}
0 commit comments