@@ -19,7 +19,6 @@ const appSettingsFixture string = `
1919 "routable": true,
2020 "allowlist": ["1.2.3.4", "0.0.0.0/0"],
2121 "autoscale": {"cmd": {"min": 3, "max": 8, "cpu_percent": 40}},
22- "canaries": ["cmd"],
2322 "label": {"git_repo": "https://github.com/drycc/controller-sdk-go", "team" : "drycc"},
2423 "created": "2014-01-01T00:00:00UTC",
2524 "updated": "2014-01-01T00:00:00UTC",
@@ -34,16 +33,14 @@ const appSettingsUnsetFixture string = `
3433 "routable": true,
3534 "allowlist": ["1.2.3.4", "0.0.0.0/0"],
3635 "autoscale": {"cmd": {"min": 3, "max": 8, "cpu_percent": 40}},
37- "canaries": ["cmd"],
3836 "label": {"git_repo": "https://github.com/drycc/controller-sdk-go", "team" : "drycc"},
3937 "created": "2014-01-01T00:00:00UTC",
4038 "updated": "2014-01-01T00:00:00UTC",
4139 "uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75"
4240}
4341`
44- const appSettingsCanaryDeleteExpected string = `{"canaries":["cmd"]}`
45- const appSettingsSetExpected string = `{"routable":true,"allowlist":["1.2.3.4","0.0.0.0/0"],"autoscale":{"cmd":{"min":3,"max":8,"cpu_percent":40}},"label":{"git_repo":"https://github.com/drycc/controller-sdk-go","team":"drycc"},"canaries":["cmd"]}`
46- const appSettingsUnsetExpected string = `{"routable":true,"allowlist":["1.2.3.4","0.0.0.0/0"],"autoscale":{"cmd":{"min":3,"max":8,"cpu_percent":40}},"label":{"git_repo":"https://github.com/drycc/controller-sdk-go","team":"drycc"},"canaries":["cmd"]}`
42+ const appSettingsSetExpected string = `{"routable":true,"allowlist":["1.2.3.4","0.0.0.0/0"],"autoscale":{"cmd":{"min":3,"max":8,"cpu_percent":40}},"label":{"git_repo":"https://github.com/drycc/controller-sdk-go","team":"drycc"}}`
43+ const appSettingsUnsetExpected string = `{"routable":true,"allowlist":["1.2.3.4","0.0.0.0/0"],"autoscale":{"cmd":{"min":3,"max":8,"cpu_percent":40}},"label":{"git_repo":"https://github.com/drycc/controller-sdk-go","team":"drycc"}}`
4744
4845type fakeHTTPServer struct {}
4946
@@ -97,25 +94,6 @@ func (f *fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
9794 return
9895 }
9996
100- if req .URL .Path == "/v2/apps/unset-test/settings/" && req .Method == "DELETE" {
101- body , err := io .ReadAll (req .Body )
102-
103- if err != nil {
104- fmt .Println (err )
105- res .WriteHeader (http .StatusInternalServerError )
106- res .Write (nil )
107- }
108- if string (body ) != appSettingsCanaryDeleteExpected {
109- fmt .Printf ("Expected '%s', Got '%s'\n " , appSettingsCanaryDeleteExpected , body )
110- res .WriteHeader (http .StatusInternalServerError )
111- res .Write (nil )
112- return
113- }
114- res .WriteHeader (http .StatusNoContent )
115- res .Write (nil )
116- return
117- }
118-
11997 fmt .Printf ("Unrecognized URL %s\n " , req .URL )
12098 res .WriteHeader (http .StatusNotFound )
12199 res .Write (nil )
@@ -145,7 +123,6 @@ func TestAppSettingsSet(t *testing.T) {
145123 CPUPercent : 40 ,
146124 },
147125 },
148- Canaries : []string {"cmd" },
149126 Label : map [string ]interface {}{
150127 "git_repo" : "https://github.com/drycc/controller-sdk-go" ,
151128 "team" : "drycc" ,
@@ -165,7 +142,6 @@ func TestAppSettingsSet(t *testing.T) {
165142 CPUPercent : 40 ,
166143 },
167144 },
168- Canaries : []string {"cmd" },
169145 Label : map [string ]interface {}{
170146 "git_repo" : "https://github.com/drycc/controller-sdk-go" ,
171147 "team" : "drycc" ,
@@ -207,7 +183,6 @@ func TestAppSettingsUnset(t *testing.T) {
207183 CPUPercent : 40 ,
208184 },
209185 },
210- Canaries : []string {"cmd" },
211186 Label : map [string ]interface {}{
212187 "git_repo" : "https://github.com/drycc/controller-sdk-go" ,
213188 "team" : "drycc" ,
@@ -227,7 +202,6 @@ func TestAppSettingsUnset(t *testing.T) {
227202 CPUPercent : 40 ,
228203 },
229204 },
230- Canaries : []string {"cmd" },
231205 Label : map [string ]interface {}{
232206 "git_repo" : "https://github.com/drycc/controller-sdk-go" ,
233207 "team" : "drycc" ,
@@ -269,7 +243,6 @@ func TestAppSettingsList(t *testing.T) {
269243 CPUPercent : 40 ,
270244 },
271245 },
272- Canaries : []string {"cmd" },
273246 Label : map [string ]interface {}{
274247 "git_repo" : "https://github.com/drycc/controller-sdk-go" ,
275248 "team" : "drycc" ,
@@ -289,64 +262,3 @@ func TestAppSettingsList(t *testing.T) {
289262 t .Errorf ("Expected %v, Got %v" , expected , actual )
290263 }
291264}
292-
293- func TestAppSettingsCanaryDelete (t * testing.T ) {
294- t .Parallel ()
295-
296- handler := fakeHTTPServer {}
297- server := httptest .NewServer (& handler )
298- defer server .Close ()
299-
300- drycc , err := drycc .New (false , server .URL , "abc" )
301- if err != nil {
302- t .Fatal (err )
303- }
304-
305- appSettingsVars := api.AppSettings {
306- Canaries : []string {"cmd" },
307- }
308-
309- err = CanaryRemove (drycc , "unset-test" , appSettingsVars )
310-
311- if err != nil {
312- t .Error (err )
313- }
314- }
315-
316- func TestAppSettingsCanaryRelease (t * testing.T ) {
317- t .Parallel ()
318-
319- handler := fakeHTTPServer {}
320- server := httptest .NewServer (& handler )
321- defer server .Close ()
322-
323- drycc , err := drycc .New (false , server .URL , "abc" )
324- if err != nil {
325- t .Fatal (err )
326- }
327-
328- err = CanaryRelease (drycc , "unset-test" )
329-
330- if err != nil {
331- t .Error (err )
332- }
333- }
334-
335- func TestAppSettingsCanaryRollback (t * testing.T ) {
336- t .Parallel ()
337-
338- handler := fakeHTTPServer {}
339- server := httptest .NewServer (& handler )
340- defer server .Close ()
341-
342- drycc , err := drycc .New (false , server .URL , "abc" )
343- if err != nil {
344- t .Fatal (err )
345- }
346-
347- err = CanaryRollback (drycc , "unset-test" )
348-
349- if err != nil {
350- t .Error (err )
351- }
352- }
0 commit comments