@@ -53,24 +53,26 @@ class DockerStackComposeIntegrationSpec extends Specification {
53
53
spec.Name == " ${ namespace} _service"
54
54
spec.Networks.Aliases == [[' service' ]]
55
55
spec.TaskTemplate.RestartPolicy == [
56
- Condition : ' on-failure' ,
57
- Delay : 5000000000 ,
56
+ Condition : ' on-failure' ,
57
+ Delay : 5000000000 ,
58
58
MaxAttempts : 3 ,
59
- Window : 120000000000
59
+ Window : 120000000000
60
60
]
61
61
62
62
containerSpec.Args == [' sh' ]
63
- containerSpec.Env == [' SOME_VAR=' + environment. SOME_VAR ]
63
+ containerSpec.Env == [' SOME_VAR=' + environment. SOME_VAR ]
64
64
containerSpec.Image =~ " alpine:${ environment.IMAGE_VERSION} (@sha256:[a-f0-9]{64})?"
65
65
containerSpec.Labels == [' com.docker.stack.namespace' : namespace]
66
66
containerSpec.Mounts == [
67
67
[
68
- Type : ' volume' ,
69
- Source : namespace + ' _shm' ,
70
- Target : ' /dev/shm' ,
68
+ Type : ' volume' ,
69
+ Source : namespace + ' _shm' ,
70
+ Target : ' /dev/shm' ,
71
71
VolumeOptions : [Labels : [' com.docker.stack.namespace' : namespace]]
72
72
]
73
73
]
74
+ containerSpec.Configs . findAll { it.ConfigName == " ${ namespace} _my-config" }. size() == 1
75
+ containerSpec.Secrets . findAll { it.SecretName == " ${ namespace} _my-secret" }. size() == 1
74
76
75
77
def networkInfo = delayAndRetrySilently { dockerClient. inspectNetwork(" ${ namespace} _my-subnet" ) }
76
78
networkInfo. status. code == 200
@@ -88,23 +90,25 @@ class DockerStackComposeIntegrationSpec extends Specification {
88
90
def performSilently (Closure action ) {
89
91
try {
90
92
action()
91
- } catch (Exception ignored) {
93
+ }
94
+ catch (Exception ignored) {
92
95
}
93
96
}
94
97
95
98
def delay (Integer secondsToWait = 1 , Closure action ) {
96
- Thread . sleep(secondsToWait * 1000 )
99
+ Thread . sleep(secondsToWait * 1000 )
97
100
action()
98
101
}
99
102
100
103
def delayAndRetrySilently (Integer secondsToWait = 1 , Closure action , Integer retryCount = 5 ) {
101
104
Object retVal = null
102
- for (_ in 1 .. retryCount) {
105
+ for (_ in 1 .. retryCount) {
103
106
try {
104
- Thread . sleep(secondsToWait * 1000 )
107
+ Thread . sleep(secondsToWait * 1000 )
105
108
retVal = action()
106
109
break
107
- } catch (Exception ignored) {}
110
+ }
111
+ catch (Exception ignored) {}
108
112
}
109
113
110
114
retVal
0 commit comments