3030import org .junit .jupiter .api .AfterAll ;
3131import org .junit .jupiter .api .Assertions ;
3232import org .junit .jupiter .api .Test ;
33+ import org .junit .jupiter .params .ParameterizedTest ;
34+ import org .junit .jupiter .params .provider .MethodSource ;
35+ import org .junit .jupiter .params .provider .ValueSource ;
3336import org .mandas .docker .client .DefaultDockerClient ;
3437import org .mandas .docker .client .DockerClient ;
3538import org .mandas .docker .client .builder .jersey .JerseyDockerClientBuilder ;
@@ -55,11 +58,12 @@ public static void afterAll() {
5558 inst .close ();
5659 }
5760
58- @ Test
59- public void testMemorySpecification () throws DockerCertificateException , DockerException , InterruptedException , InvalidParametersException {
61+ @ ValueSource (strings = {"01_hello_memory1" , "01_hello_memory5" })
62+ @ ParameterizedTest
63+ public void testMemoryAndCpuSpecification (String value ) throws DockerCertificateException , DockerException , InterruptedException , InvalidParametersException {
6064 try (ContainerSetup containerSetup = new ContainerSetup ("docker" )) {
6165 try (DefaultDockerClient dockerClient = new JerseyDockerClientBuilder ().fromEnv ().build ()) {
62- String id = inst .client .startProxy ("01_hello_memory1" );
66+ String id = inst .client .startProxy (value );
6367 Proxy proxy = inst .proxyService .getProxy (id );
6468
6569 List <Container > containers = dockerClient .listContainers (DockerClient .ListContainersParam .withStatusRunning (), DockerClient .ListContainersParam .withLabel ("openanalytics.eu/sp-proxied-app" ));
@@ -69,6 +73,8 @@ public void testMemorySpecification() throws DockerCertificateException, DockerE
6973 ContainerInfo containerInfo = dockerClient .inspectContainer (container .id ());
7074 Assertions .assertEquals (268435456 , containerInfo .hostConfig ().memoryReservation ());
7175 Assertions .assertEquals (1073741824 , containerInfo .hostConfig ().memory ());
76+ Assertions .assertEquals (100_000 , containerInfo .hostConfig ().cpuPeriod ());
77+ Assertions .assertEquals (25_000 , containerInfo .hostConfig ().cpuQuota ());
7278
7379 inst .proxyService .stopProxy (null , proxy , true ).run ();
7480 }
0 commit comments