Skip to content

Commit e73ce53

Browse files
committed
chore(maintenance): remove maintenance support
1 parent 9d56a7f commit e73ce53

2 files changed

Lines changed: 18 additions & 67 deletions

File tree

api/appsettings.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ type AppSettings struct {
1818
// UUID is a unique string reflecting the application settings in its current state.
1919
// It changes every time the application settings is changed and cannot be updated.
2020
UUID string `json:"uuid,omitempty"`
21-
// Maintenance determines if the application is taken down for maintenance or not.
22-
Maintenance *bool `json:"maintenance,omitempty"`
2321
// Routable determines if the application should be exposed by the router.
2422
Routable *bool `json:"routable,omitempty"`
2523
Whitelist []string `json:"whitelist,omitempty"`

appsettings/appsettings_test.go

Lines changed: 18 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const appSettingsFixture string = `
1616
{
1717
"owner": "test",
1818
"app": "example-go",
19-
"maintenance": true,
2019
"routable": true,
2120
"whitelist": ["1.2.3.4", "0.0.0.0/0"],
2221
"autoscale": {"cmd": {"min": 3, "max": 8, "cpu_percent": 40}},
@@ -31,7 +30,6 @@ const appSettingsUnsetFixture string = `
3130
{
3231
"owner": "test",
3332
"app": "unset-test",
34-
"maintenance": true,
3533
"routable": true,
3634
"whitelist": ["1.2.3.4", "0.0.0.0/0"],
3735
"autoscale": {"cmd": {"min": 3, "max": 8, "cpu_percent": 40}},
@@ -42,10 +40,8 @@ const appSettingsUnsetFixture string = `
4240
}
4341
`
4442

45-
const appSettingsSetExpected string = `{"maintenance":true,"routable":true,"whitelist":["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"}}`
46-
const appSettingsUnsetExpected string = `{"maintenance":true,"routable":true,"whitelist":["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"}}`
47-
48-
var trueVar = true
43+
const appSettingsSetExpected string = `{"routable":true,"whitelist":["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"}}`
44+
const appSettingsUnsetExpected string = `{"routable":true,"whitelist":["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"}}`
4945

5046
type fakeHTTPServer struct{}
5147

@@ -94,22 +90,11 @@ func (f *fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
9490
return
9591
}
9692

97-
if req.URL.Path == "/v2/apps/invalidjson-test/settings/" && req.Method == "POST" {
98-
res.WriteHeader(http.StatusCreated)
99-
res.Write([]byte(`"maintenance": "test"`))
100-
return
101-
}
102-
10393
if req.URL.Path == "/v2/apps/example-go/settings/" && req.Method == "GET" {
10494
res.Write([]byte(appSettingsFixture))
10595
return
10696
}
10797

108-
if req.URL.Path == "/v2/apps/invalidjson-test/settings/" && req.Method == "GET" {
109-
res.Write([]byte(`"maintenance": "test"`))
110-
return
111-
}
112-
11398
fmt.Printf("Unrecognized URL %s\n", req.URL)
11499
res.WriteHeader(http.StatusNotFound)
115100
res.Write(nil)
@@ -128,11 +113,10 @@ func TestAppSettingsSet(t *testing.T) {
128113
}
129114

130115
expected := api.AppSettings{
131-
Owner: "test",
132-
App: "example-go",
133-
Routable: api.NewRoutable(),
134-
Maintenance: &trueVar,
135-
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
116+
Owner: "test",
117+
App: "example-go",
118+
Routable: api.NewRoutable(),
119+
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
136120
Autoscale: map[string]*api.Autoscale{
137121
"cmd": {
138122
Min: 3,
@@ -150,9 +134,8 @@ func TestAppSettingsSet(t *testing.T) {
150134
}
151135

152136
appSettingsVars := api.AppSettings{
153-
Maintenance: &trueVar,
154-
Routable: api.NewRoutable(),
155-
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
137+
Routable: api.NewRoutable(),
138+
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
156139
Autoscale: map[string]*api.Autoscale{
157140
"cmd": {
158141
Min: 3,
@@ -190,11 +173,10 @@ func TestAppSettingsUnset(t *testing.T) {
190173
}
191174

192175
expected := api.AppSettings{
193-
Owner: "test",
194-
App: "unset-test",
195-
Maintenance: &trueVar,
196-
Routable: api.NewRoutable(),
197-
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
176+
Owner: "test",
177+
App: "unset-test",
178+
Routable: api.NewRoutable(),
179+
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
198180
Autoscale: map[string]*api.Autoscale{
199181
"cmd": {
200182
Min: 3,
@@ -212,9 +194,8 @@ func TestAppSettingsUnset(t *testing.T) {
212194
}
213195

214196
appSettingsVars := api.AppSettings{
215-
Maintenance: &trueVar,
216-
Routable: api.NewRoutable(),
217-
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
197+
Routable: api.NewRoutable(),
198+
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
218199
Autoscale: map[string]*api.Autoscale{
219200
"cmd": {
220201
Min: 3,
@@ -252,11 +233,10 @@ func TestAppSettingsList(t *testing.T) {
252233
}
253234

254235
expected := api.AppSettings{
255-
Owner: "test",
256-
App: "example-go",
257-
Maintenance: &trueVar,
258-
Routable: api.NewRoutable(),
259-
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
236+
Owner: "test",
237+
App: "example-go",
238+
Routable: api.NewRoutable(),
239+
Whitelist: []string{"1.2.3.4", "0.0.0.0/0"},
260240
Autoscale: map[string]*api.Autoscale{
261241
"cmd": {
262242
Min: 3,
@@ -283,30 +263,3 @@ func TestAppSettingsList(t *testing.T) {
283263
t.Errorf("Expected %v, Got %v", expected, actual)
284264
}
285265
}
286-
287-
func TestAppSettingsInvalidJson(t *testing.T) {
288-
t.Parallel()
289-
290-
handler := fakeHTTPServer{}
291-
server := httptest.NewServer(&handler)
292-
defer server.Close()
293-
294-
drycc, err := drycc.New(false, server.URL, "abc")
295-
if err != nil {
296-
t.Fatal(err)
297-
}
298-
299-
_, err = List(drycc, "invalidjson-test")
300-
expected := "json: cannot unmarshal string into Go value of type api.AppSettings"
301-
if err == nil || !reflect.DeepEqual(expected, err.Error()) {
302-
t.Errorf("Expected %v, Got %v", expected, err)
303-
}
304-
305-
appSettingsVars := api.AppSettings{
306-
Maintenance: &trueVar,
307-
}
308-
_, err = Set(drycc, "invalidjson-test", appSettingsVars)
309-
if err == nil || !reflect.DeepEqual(expected, err.Error()) {
310-
t.Errorf("Expected %v, Got %v", expected, err)
311-
}
312-
}

0 commit comments

Comments
 (0)