From 15fe40ec82b0d527a11d60418b1851fa1299c52c Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Mon, 14 Mar 2022 20:35:39 +0100 Subject: [PATCH] trying to reproduce issue #267 relates to #267 --- .../stack/DeployConfigReaderTest.groovy | 25 +++++++++++++++ .../src/test/resources/configs/issue-267.yaml | 32 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 client/src/test/resources/configs/issue-267.yaml diff --git a/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy b/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy index b01d8aa4..e684ca42 100644 --- a/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy +++ b/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy @@ -1,6 +1,7 @@ package de.gesellix.docker.client.stack import de.gesellix.docker.client.DockerClient +import de.gesellix.docker.client.DockerClientImpl import de.gesellix.docker.client.stack.types.StackConfig import de.gesellix.docker.client.stack.types.StackSecret import de.gesellix.docker.compose.types.Command @@ -30,6 +31,7 @@ import de.gesellix.docker.remote.api.EndpointSpec import de.gesellix.docker.remote.api.HealthConfig import de.gesellix.docker.remote.api.IPAM import de.gesellix.docker.remote.api.Limit +import de.gesellix.docker.remote.api.LocalNodeState import de.gesellix.docker.remote.api.Mount import de.gesellix.docker.remote.api.MountBindOptions import de.gesellix.docker.remote.api.MountVolumeOptions @@ -664,4 +666,27 @@ class DeployConfigReaderTest extends Specification { "key1=value1" ] } + + def "issue-276"() { + given: + def config1 = new de.gesellix.docker.compose.types.StackConfig() + def config1File = getClass().getResource('/configs/issue-267.yaml').file + def config1FileDirectory = new File(config1File).parent + config1.file = 'issue-267.yaml' + + reader.dockerClient = new DockerClientImpl() + if (reader.dockerClient.info().content.swarm.localNodeState == LocalNodeState.Inactive) { + reader.dockerClient.initSwarm() + } +// reader.dockerClient.createNetwork("ingress-routing") + + when: + def result = reader.loadCompose( + "name-space", + new FileInputStream(config1File), + config1FileDirectory, System.getenv()) + + then: + !result.networks?.isEmpty() + } } diff --git a/client/src/test/resources/configs/issue-267.yaml b/client/src/test/resources/configs/issue-267.yaml new file mode 100644 index 00000000..8169a63d --- /dev/null +++ b/client/src/test/resources/configs/issue-267.yaml @@ -0,0 +1,32 @@ +--- +version: 3.9 +services: + xmdb: + image: xmdb + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: secret + PGDATA: /var/lib/postgresql/data/pgdata + ports: + - "6012:5432" + networks: [xmnet-zh] + volumes: [/opt/containers/xm/zh:/var/lib/postgresql/data] + deploy: + replicas: 1 + xmapp: + depends_on: [xmdb] + image: xmapp + ports: ["9012:8080"] + networks: [xmnet-zh, ingress] + deploy: + replicas: 1 + labels: + ingress.host: zh.xm.local + ingress.port: 8080 +networks: + xmnet-zh: + ingress: + external: true +# ingress-routing: +# external: true +...