@@ -31,39 +31,6 @@ const processesFixture string = `
3131 ]
3232}`
3333
34- const restartAllFixture string = `[
35- {
36- "release": "v2",
37- "type": "web",
38- "name": "example-go-v2-web-45678",
39- "state": "up",
40- "started": "2016-02-13T00:47:52"
41- }
42- ]
43- `
44-
45- const restartWorkerFixture string = `[
46- {
47- "release": "v2",
48- "type": "worker",
49- "name": "example-go-v2-worker-45678",
50- "state": "up",
51- "started": "2016-02-13T00:47:52"
52- }
53- ]
54- `
55-
56- const restartWebTwoFixture string = `[
57- {
58- "release": "v2",
59- "type": "web",
60- "name": "example-go-v2-web-45678",
61- "state": "up",
62- "started": "2016-02-13T00:47:52"
63- }
64- ]
65- `
66-
6734const scaleExpected string = `{"web":2}`
6835
6936var upgrader = websocket.Upgrader {} // use default options
@@ -102,22 +69,12 @@ func (fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
10269 }
10370
10471 if req .URL .Path == "/v2/apps/example-go/pods/restart/" && req .Method == "POST" {
105- res .Write ([] byte ( restartAllFixture ) )
72+ res .WriteHeader ( http . StatusNoContent )
10673 return
10774 }
10875
10976 if req .URL .Path == "/v2/apps/example-go/pods/web/restart/" && req .Method == "POST" {
110- res .Write ([]byte (restartWebTwoFixture ))
111- return
112- }
113-
114- if req .URL .Path == "/v2/apps/example-go/pods/worker/example-go-v2-worker-45678/restart/" && req .Method == "POST" {
115- res .Write ([]byte (restartWorkerFixture ))
116- return
117- }
118-
119- if req .URL .Path == "/v2/apps/example-go/pods/worker/worker-45678/restart/" && req .Method == "POST" {
120- res .Write ([]byte (restartWorkerFixture ))
77+ res .WriteHeader (http .StatusNoContent )
12178 return
12279 }
12380
@@ -219,56 +176,10 @@ func TestAppsRestart(t *testing.T) {
219176 started .UnmarshalText ([]byte ("2016-02-13T00:47:52" ))
220177 tests := []testExpected {
221178 {
222- Name : "" ,
223179 Type : "" ,
224- Expected : []api.Pods {
225- {
226- Release : "v2" ,
227- Type : "web" ,
228- Name : "example-go-v2-web-45678" ,
229- State : "up" ,
230- Started : started ,
231- },
232- },
233180 },
234181 {
235- Name : "example-go-v2-worker-45678" ,
236- Type : "worker" ,
237- Expected : []api.Pods {
238- {
239- Release : "v2" ,
240- Type : "worker" ,
241- Name : "example-go-v2-worker-45678" ,
242- State : "up" ,
243- Started : started ,
244- },
245- },
246- },
247- {
248- Name : "worker-45678" ,
249- Type : "worker" ,
250- Expected : []api.Pods {
251- {
252- Release : "v2" ,
253- Type : "worker" ,
254- Name : "example-go-v2-worker-45678" ,
255- State : "up" ,
256- Started : started ,
257- },
258- },
259- },
260- {
261- Name : "" ,
262182 Type : "web" ,
263- Expected : []api.Pods {
264- {
265- Release : "v2" ,
266- Type : "web" ,
267- Name : "example-go-v2-web-45678" ,
268- State : "up" ,
269- Started : started ,
270- },
271- },
272183 },
273184 }
274185
@@ -282,15 +193,11 @@ func TestAppsRestart(t *testing.T) {
282193 }
283194
284195 for _ , test := range tests {
285- actual , err := Restart (drycc , "example-go" , test .Type , test . Name )
196+ err := Restart (drycc , "example-go" , test .Type )
286197
287198 if err != nil {
288199 t .Error (err )
289200 }
290-
291- if ! reflect .DeepEqual (test .Expected , actual ) {
292- t .Error (fmt .Errorf ("Expected %v, Got %v" , test .Expected , actual ))
293- }
294201 }
295202}
296203
0 commit comments