Skip to content

Commit 337eb3e

Browse files
committed
add integration test for secrets and configs
1 parent 77105ec commit 337eb3e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

integration-test/src/test/groovy/de/gesellix/docker/client/DockerStackComposeIntegrationSpec.groovy

+16-12
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,26 @@ class DockerStackComposeIntegrationSpec extends Specification {
5353
spec.Name == "${namespace}_service"
5454
spec.Networks.Aliases == [['service']]
5555
spec.TaskTemplate.RestartPolicy == [
56-
Condition: 'on-failure',
57-
Delay: 5000000000,
56+
Condition : 'on-failure',
57+
Delay : 5000000000,
5858
MaxAttempts: 3,
59-
Window: 120000000000
59+
Window : 120000000000
6060
]
6161

6262
containerSpec.Args == ['sh']
63-
containerSpec.Env == ['SOME_VAR='+environment.SOME_VAR]
63+
containerSpec.Env == ['SOME_VAR=' + environment.SOME_VAR]
6464
containerSpec.Image =~ "alpine:${environment.IMAGE_VERSION}(@sha256:[a-f0-9]{64})?"
6565
containerSpec.Labels == ['com.docker.stack.namespace': namespace]
6666
containerSpec.Mounts == [
6767
[
68-
Type: 'volume',
69-
Source: namespace + '_shm',
70-
Target: '/dev/shm',
68+
Type : 'volume',
69+
Source : namespace + '_shm',
70+
Target : '/dev/shm',
7171
VolumeOptions: [Labels: ['com.docker.stack.namespace': namespace]]
7272
]
7373
]
74+
containerSpec.Configs.findAll { it.ConfigName == "${namespace}_my-config" }.size() == 1
75+
containerSpec.Secrets.findAll { it.SecretName == "${namespace}_my-secret" }.size() == 1
7476

7577
def networkInfo = delayAndRetrySilently { dockerClient.inspectNetwork("${namespace}_my-subnet") }
7678
networkInfo.status.code == 200
@@ -88,23 +90,25 @@ class DockerStackComposeIntegrationSpec extends Specification {
8890
def performSilently(Closure action) {
8991
try {
9092
action()
91-
} catch (Exception ignored) {
93+
}
94+
catch (Exception ignored) {
9295
}
9396
}
9497

9598
def delay(Integer secondsToWait = 1, Closure action) {
96-
Thread.sleep(secondsToWait *1000)
99+
Thread.sleep(secondsToWait * 1000)
97100
action()
98101
}
99102

100103
def delayAndRetrySilently(Integer secondsToWait = 1, Closure action, Integer retryCount = 5) {
101104
Object retVal = null
102-
for (_ in 1 .. retryCount) {
105+
for (_ in 1..retryCount) {
103106
try {
104-
Thread.sleep(secondsToWait *1000)
107+
Thread.sleep(secondsToWait * 1000)
105108
retVal = action()
106109
break
107-
} catch (Exception ignored) {}
110+
}
111+
catch (Exception ignored) {}
108112
}
109113

110114
retVal

0 commit comments

Comments
 (0)