Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeSeqLabs committed Sep 29, 2023
1 parent 4b47e16 commit 20e3f74
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.mockserver.client.MockServerClient;
import org.mockserver.model.JsonBody;
import org.mockserver.model.MediaType;

import java.io.IOException;
Expand Down Expand Up @@ -355,7 +356,30 @@ void testImport(OutputType format, MockServerClient mock) throws IOException {
);

mock.when(
request().withMethod("POST").withPath("/compute-envs").withBody("{\"computeEnv\":{\"name\":\"json\",\"platform\":\"aws-batch\",\"config\":{\"region\":\"eu-west-1\",\"cliPath\":\"/home/ec2-user/miniconda/bin/aws\",\"workDir\":\"s3://nextflow-ci/jordeu\",\"forge\":{\"type\":\"SPOT\",\"minCpus\":0,\"maxCpus\":123,\"gpuEnabled\":false,\"ebsAutoScale\":true,\"disposeOnDeletion\":true,\"fusionEnabled\":false,\"efsCreate\":true},\"discriminator\":\"aws-batch\"},\"credentialsId\":\"6g0ER59L4ZoE5zpOmUP48D\"}}"), exactly(1)
request().withMethod("POST").withPath("/compute-envs").withBody(JsonBody.json("{\n" +
" \"computeEnv\":{\n" +
" \"name\": \"json\",\n" +
" \"platform\": \"aws-batch\",\n" +
" \"config\": {\n" +
" \"region\": \"eu-west-1\",\n" +
" \"cliPath\": \"/home/ec2-user/miniconda/bin/aws\",\n" +
" \"workDir\": \"s3://nextflow-ci/jordeu\",\n" +
" \"forge\": {\n" +
" \"type\": \"SPOT\",\n" +
" \"minCpus\": 0,\n" +
" \"maxCpus\": 123,\n" +
" \"gpuEnabled\": false,\n" +
" \"ebsAutoScale\": true,\n" +
" \"disposeOnDeletion\": true,\n" +
" \"fusionEnabled\": false,\n" +
" \"efsCreate\": true\n" +
" },\n" +
" \"discriminator\": \"aws-batch\"\n" +
" },\n" +
" \"credentialsId\": \"6g0ER59L4ZoE5zpOmUP48D\"\n" +
" },\n" +
" \"labelIds\": []\n" +
"}")), exactly(1)
).respond(
response().withStatusCode(200).withBody("{\"computeEnvId\":\"3T6xWeFD63QIuzdAowvSTC\"}").withContentType(MediaType.APPLICATION_JSON)
);
Expand Down Expand Up @@ -398,7 +422,32 @@ void testImportWithOverwrite(OutputType format, MockServerClient mock) throws IO
);

mock.when(
request().withMethod("POST").withPath("/compute-envs").withBody("{\"computeEnv\":{\"name\":\"demo\",\"platform\":\"aws-batch\",\"config\":{\"region\":\"eu-west-1\",\"cliPath\":\"/home/ec2-user/miniconda/bin/aws\",\"workDir\":\"s3://nextflow-ci/jordeu\",\"forge\":{\"type\":\"SPOT\",\"minCpus\":0,\"maxCpus\":123,\"gpuEnabled\":false,\"ebsAutoScale\":true,\"disposeOnDeletion\":true,\"fusionEnabled\":false,\"efsCreate\":true},\"discriminator\":\"aws-batch\"},\"credentialsId\":\"6g0ER59L4ZoE5zpOmUP48D\"}}"), exactly(1)
request().withMethod("POST").withPath("/compute-envs")
.withBody(JsonBody.json("{\n" +
" \"computeEnv\":{\n" +
" \"name\": \"demo\",\n" +
" \"platform\": \"aws-batch\",\n" +
" \"config\": {\n" +
" \"region\": \"eu-west-1\",\n" +
" \"cliPath\": \"/home/ec2-user/miniconda/bin/aws\",\n" +
" \"workDir\": \"s3://nextflow-ci/jordeu\",\n" +
" \"forge\": {\n" +
" \"type\": \"SPOT\",\n" +
" \"minCpus\": 0,\n" +
" \"maxCpus\": 123,\n" +
" \"gpuEnabled\": false,\n" +
" \"ebsAutoScale\": true,\n" +
" \"disposeOnDeletion\": true,\n" +
" \"fusionEnabled\": false,\n" +
" \"efsCreate\": true\n" +
" },\n" +
" \"discriminator\": \"aws-batch\"\n" +
" },\n" +
" \"credentialsId\": \"6g0ER59L4ZoE5zpOmUP48D\"\n" +
"},\n" +
" \"labelIds\": []\n" +
"}\n" +
" ")), exactly(1)
).respond(
response().withStatusCode(200).withBody("{\"computeEnvId\":\"3T6xWeFD63QIuzdAowvSTC\"}").withContentType(MediaType.APPLICATION_JSON)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void testFormatDeserialization() throws JsonProcessingException {
assertNotNull(ce.getLabels());

assertTrue(ce.getLabels().size() == 1);
assertEquals("eu-west-2", ce.getConfig().getDiscriminator());
assertEquals("aws-batch", ce.getConfig().getDiscriminator());
}

@Test
Expand Down

0 comments on commit 20e3f74

Please sign in to comment.