arquillian / arquillian-cube

Control (docker, kubernetes, openshift) containers in your tests with ease!
http://arquillian.org/arquillian-cube/
120 stars 98 forks source link

Support for docker-compose file version 3 #1084

Closed jollytoad closed 5 years ago

jollytoad commented 5 years ago
Issue Overview

DockerComposeConverter currently interprets a docker-compose version 3 file as version 1.

Expected Behaviour

I expect it would read the file, even if all version 3 features weren't support.

Current Behaviour

Throws an exception:

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map at org.arquillian.cube.docker.impl.util.YamlUtil.asMap(YamlUtil.java:32) at org.arquillian.cube.docker.impl.docker.compose.DockerComposeConverter.convert(DockerComposeConverter.java:73)

Steps To Reproduce

Provide a version 3 docker-compose.yml file.

Additional Information

org.arquillian.cube.docker.impl.docker.compose.DockerComposeConverter, line 68:

boolean isV2 = names.contains(DOCKER_COMPOSE_VERSION_KEY) && DOCKER_COMPOSE_VERSION_2_VALUE.equals(dockerComposeDefinitionMap.get(DOCKER_COMPOSE_VERSION_KEY));

could do with parsing the version property as a number and comparing:

boolean isV2 = names.contains(DOCKER_COMPOSE_VERSION_KEY) && Integer.parseInt(dockerComposeDefinitionMap.get(DOCKER_COMPOSE_VERSION_KEY)) >= 2;

lordofthejars commented 5 years ago

Yes, I'll do it and release ASAP

lordofthejars commented 5 years ago

I have just released 1.18.1 with this fix. Waiting until it goes to central.

Thank you very much.