@@ -30,7 +30,7 @@ Examples: web=30 worker=300`
3030 {"=1" , "" , "" , true , "=1" + errorHint },
3131 {"web=" , "" , "" , true , "web=" + errorHint },
3232 {"1=" , "" , "" , true , "1=" + errorHint },
33- {"web=ABCD" , "" , "" , true , "web=G " + errorHint },
33+ {"web=ABCD" , "" , "" , true , "web=ABCD " + errorHint },
3434 }
3535
3636 for _ , check := range cases {
@@ -57,7 +57,7 @@ func TestTimeoutTags(t *testing.T) {
5757
5858 cases := []parseTimeoutsCase {
5959 {[]string {"web=10" , "worker=20" }, map [string ]interface {}{"web" : "10" , "worker" : "20" }, false , "" },
60- {[]string {"foo=" , "web=1G " }, nil , true , `foo= doesn't fit format type=#
60+ {[]string {"foo=" , "web=10 " }, nil , true , `foo= doesn't fit format type=#
6161Examples: web=30 worker=300` },
6262 }
6363
@@ -105,10 +105,9 @@ func TestTimeoutsList(t *testing.T) {
105105
106106 err = cmdr .TimeoutsList ("enterprise" )
107107 assert .NoErr (t , err )
108- assert .Equal (t , b .String (), `=== enterprise Timeouts
109- web 10
110- worker 20
111-
108+ assert .Equal (t , b .String (), `=== enterprise Timeouts (sec)
109+ web 10
110+ worker 20
112111` , "output" )
113112
114113 server .Mux .HandleFunc ("/v2/apps/franklin/config/" , func (w http.ResponseWriter , r * http.Request ) {
@@ -130,9 +129,8 @@ worker 20
130129
131130 err = cmdr .TimeoutsList ("franklin" )
132131 assert .NoErr (t , err )
133- assert .Equal (t , b .String (), `=== franklin Timeouts
132+ assert .Equal (t , b .String (), `=== franklin Timeouts (sec)
134133default (30 sec) or controlled by env KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS
135-
136134` , "output" )
137135}
138136
@@ -148,7 +146,7 @@ func TestTimeoutsSet(t *testing.T) {
148146 testutil .SetHeaders (w )
149147 if r .Method == "POST" {
150148 testutil .AssertBody (t , api.Config {
151- CPU : map [string ]interface {}{
149+ Timeout : map [string ]interface {}{
152150 "web" : "10" ,
153151 },
154152 }, r )
@@ -161,7 +159,7 @@ func TestTimeoutsSet(t *testing.T) {
161159 "memory": {},
162160 "cpu": {},
163161 "termination_grace_period": {
164- "web": 10
162+ "web": "10"
165163 },
166164 "tags": {},
167165 "registry": {},
@@ -179,16 +177,16 @@ func TestTimeoutsSet(t *testing.T) {
179177
180178 assert .Equal (t , testutil .StripProgress (b .String ()), `Applying timeouts... done
181179
182- === foo Timeouts
183-
180+ === foo Timeouts (sec)
181+ web 10
184182` , "output" )
185183
186184 server .Mux .HandleFunc ("/v2/apps/franklin/config/" , func (w http.ResponseWriter , r * http.Request ) {
187185 testutil .SetHeaders (w )
188186 if r .Method == "POST" {
189187 testutil .AssertBody (t , api.Config {
190- Memory : map [string ]interface {}{
191- "web" : 10 ,
188+ Timeout : map [string ]interface {}{
189+ "web" : "10" ,
192190 },
193191 }, r )
194192 }
@@ -200,8 +198,8 @@ func TestTimeoutsSet(t *testing.T) {
200198 "memory": {},
201199 "cpu": {},
202200 "termination_grace_period": {
203- "web": 10
204- }
201+ "web": "10"
202+ },
205203 "tags": {},
206204 "registry": {},
207205 "created": "2014-01-01T00:00:00UTC",
@@ -216,20 +214,19 @@ func TestTimeoutsSet(t *testing.T) {
216214
217215 assert .Equal (t , testutil .StripProgress (b .String ()), `Applying timeouts... done
218216
219- === franklin Timeouts
217+ === franklin Timeouts (sec)
220218web 10
221-
222219` , "output" )
223220
224221 // with requests/timeout parameter
225222 server .Mux .HandleFunc ("/v2/apps/jim/config/" , func (w http.ResponseWriter , r * http.Request ) {
226223 testutil .SetHeaders (w )
227224 if r .Method == "POST" {
228225 testutil .AssertBody (t , api.Config {
229- Memory : map [string ]interface {}{
230- "web" : 10 ,
231- "worker" : 100 ,
232- "db" : 300 ,
226+ Timeout : map [string ]interface {}{
227+ "web" : "10" ,
228+ "worker" : " 100" ,
229+ "db" : " 300" ,
233230 },
234231 }, r )
235232 }
@@ -238,12 +235,12 @@ web 10
238235 "owner": "foo",
239236 "app": "jim",
240237 "values": {},
241- "memory": {}
238+ "memory": {},
242239 "cpu": {},
243240 "termination_grace_period": {
244- "web": 10 ,
245- "worker": 100,
246- "db": 300
241+ "web": "10" ,
242+ "worker": " 100" ,
243+ "db": " 300"
247244 },
248245 "tags": {},
249246 "registry": {},
@@ -259,11 +256,10 @@ web 10
259256
260257 assert .Equal (t , testutil .StripProgress (b .String ()), `Applying timeouts... done
261258
262- === jim Timeouts
259+ === jim Timeouts (sec)
263260db 300
264261web 10
265262worker 100
266-
267263` , "output" )
268264
269265}
@@ -280,7 +276,7 @@ func TestTimeoutsUnset(t *testing.T) {
280276 testutil .SetHeaders (w )
281277 if r .Method == "POST" {
282278 testutil .AssertBody (t , api.Config {
283- Memory : map [string ]interface {}{
279+ Timeout : map [string ]interface {}{
284280 "web" : nil ,
285281 },
286282 }, r )
@@ -311,15 +307,15 @@ func TestTimeoutsUnset(t *testing.T) {
311307
312308 assert .Equal (t , testutil .StripProgress (b .String ()), `Applying timeouts... done
313309
314- === foo Timeouts
310+ === foo Timeouts (sec)
315311web 10
316312` , "output" )
317313
318314 server .Mux .HandleFunc ("/v2/apps/franklin/config/" , func (w http.ResponseWriter , r * http.Request ) {
319315 testutil .SetHeaders (w )
320316 if r .Method == "POST" {
321317 testutil .AssertBody (t , api.Config {
322- CPU : map [string ]interface {}{
318+ Timeout : map [string ]interface {}{
323319 "web" : nil ,
324320 },
325321 }, r )
@@ -348,7 +344,7 @@ web 10
348344
349345 assert .Equal (t , testutil .StripProgress (b .String ()), `Applying timeouts... done
350346
351- === franklin Timeouts
347+ === franklin Timeouts (sec)
352348web 10
353349` , "output" )
354350}
0 commit comments