@@ -74,3 +74,92 @@ func TestValidatePlacement(t *testing.T) {
7474
7575 assert .NoError (t , Validate (config , "3.3" ))
7676}
77+
78+ func TestValidateRollbackConfig (t * testing.T ) {
79+ config := dict {
80+ "version" : "3.4" ,
81+ "services" : dict {
82+ "foo" : dict {
83+ "image" : "busybox" ,
84+ "deploy" : dict {
85+ "rollback_config" : dict {
86+ "parallelism" : 1 ,
87+ },
88+ },
89+ },
90+ },
91+ }
92+
93+ assert .NoError (t , Validate (config , "3.4" ))
94+ }
95+
96+ func TestValidateRollbackConfigWithOrder (t * testing.T ) {
97+ config := dict {
98+ "version" : "3.4" ,
99+ "services" : dict {
100+ "foo" : dict {
101+ "image" : "busybox" ,
102+ "deploy" : dict {
103+ "rollback_config" : dict {
104+ "parallelism" : 1 ,
105+ "order" : "start-first" ,
106+ },
107+ },
108+ },
109+ },
110+ }
111+
112+ assert .NoError (t , Validate (config , "3.4" ))
113+ }
114+
115+ func TestValidateRollbackConfigWithUpdateConfig (t * testing.T ) {
116+ config := dict {
117+ "version" : "3.4" ,
118+ "services" : dict {
119+ "foo" : dict {
120+ "image" : "busybox" ,
121+ "deploy" : dict {
122+ "update_config" : dict {
123+ "parallelism" : 1 ,
124+ "order" : "start-first" ,
125+ },
126+ "rollback_config" : dict {
127+ "parallelism" : 1 ,
128+ "order" : "start-first" ,
129+ },
130+ },
131+ },
132+ },
133+ }
134+
135+ assert .NoError (t , Validate (config , "3.4" ))
136+ }
137+
138+ func TestValidateRollbackConfigWithUpdateConfigFull (t * testing.T ) {
139+ config := dict {
140+ "version" : "3.4" ,
141+ "services" : dict {
142+ "foo" : dict {
143+ "image" : "busybox" ,
144+ "deploy" : dict {
145+ "update_config" : dict {
146+ "parallelism" : 1 ,
147+ "order" : "start-first" ,
148+ "delay" : "10s" ,
149+ "failure_action" : "pause" ,
150+ "monitor" : "10s" ,
151+ },
152+ "rollback_config" : dict {
153+ "parallelism" : 1 ,
154+ "order" : "start-first" ,
155+ "delay" : "10s" ,
156+ "failure_action" : "pause" ,
157+ "monitor" : "10s" ,
158+ },
159+ },
160+ },
161+ },
162+ }
163+
164+ assert .NoError (t , Validate (config , "3.4" ))
165+ }
0 commit comments