Skip to content

Commit 5238576

Browse files
fix(apps): remove unused and incorrect URL field (#57)
1 parent b829e2e commit 5238576

4 files changed

Lines changed: 4 additions & 28 deletions

File tree

api/apps.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ type App struct {
66
ID string `json:"id"`
77
Owner string `json:"owner"`
88
Updated string `json:"updated"`
9-
URL string `json:"-"`
109
UUID string `json:"uuid"`
1110
}
1211

api/apps_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77

88
func TestAppsSorted(t *testing.T) {
99
apps := Apps{
10-
{"2014-01-01T00:00:00UTC", "Zulu", "John", "2016-01-02", "zulu.example.com", "d57be2ba-7ae2-4825-9ace-7c86cb893046"},
11-
{"2014-01-01T00:00:00UTC", "Alpha", "John", "2016-01-02", "alpha.example.com", "3d501190-1b8e-41ef-94c5-dd9a0bb707bb"},
12-
{"2014-01-01T00:00:00UTC", "Gamma", "John", "2016-01-02", "gamma.example.com", "41d95133-fd4d-4f4c-92a2-e454857371cc"},
13-
{"2014-01-01T00:00:00UTC", "Beta", "John", "2016-01-02", "beta.example.com", "222ed1aa-e985-4bec-9966-a88215300661"},
10+
{"2014-01-01T00:00:00UTC", "Zulu", "John", "2016-01-02", "d57be2ba-7ae2-4825-9ace-7c86cb893046"},
11+
{"2014-01-01T00:00:00UTC", "Alpha", "John", "2016-01-02", "3d501190-1b8e-41ef-94c5-dd9a0bb707bb"},
12+
{"2014-01-01T00:00:00UTC", "Gamma", "John", "2016-01-02", "41d95133-fd4d-4f4c-92a2-e454857371cc"},
13+
{"2014-01-01T00:00:00UTC", "Beta", "John", "2016-01-02", "222ed1aa-e985-4bec-9966-a88215300661"},
1414
}
1515

1616
sort.Sort(apps)

apps/apps.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"io"
99
"io/ioutil"
1010
"strconv"
11-
"strings"
1211

1312
deis "github.com/deis/controller-sdk-go"
1413
"github.com/deis/controller-sdk-go/api"
@@ -37,12 +36,6 @@ func List(c *deis.Client, results int) (api.Apps, int, error) {
3736
return []api.App{}, -1, err
3837
}
3938

40-
for name, app := range apps {
41-
// Add in app URL based on controller hostname, port included
42-
app.URL = fmt.Sprintf("%s.%s", app.ID, strings.TrimPrefix(c.ControllerURL.Host, workflowURLPrefix))
43-
apps[name] = app
44-
}
45-
4639
return apps, count, nil
4740
}
4841

@@ -78,9 +71,6 @@ func New(c *deis.Client, appID string) (api.App, error) {
7871
return api.App{}, err
7972
}
8073

81-
// Add in app URL based on controller hostname, port included
82-
app.URL = fmt.Sprintf("%s.%s", app.ID, strings.TrimPrefix(c.ControllerURL.Host, workflowURLPrefix))
83-
8474
return app, reqErr
8575
}
8676

@@ -104,9 +94,6 @@ func Get(c *deis.Client, appID string) (api.App, error) {
10494
return api.App{}, err
10595
}
10696

107-
// Add in app URL based on controller hostname, port included
108-
app.URL = fmt.Sprintf("%s.%s", app.ID, strings.TrimPrefix(c.ControllerURL.Host, workflowURLPrefix))
109-
11097
return app, reqErr
11198
}
11299

apps/apps_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"io/ioutil"
66
"net/http"
77
"net/http/httptest"
8-
"net/url"
98
"reflect"
109
"testing"
1110

@@ -162,14 +161,11 @@ func TestAppsCreate(t *testing.T) {
162161
server := httptest.NewServer(&handler)
163162
defer server.Close()
164163

165-
u, _ := url.Parse(server.URL)
166-
167164
expected := api.App{
168165
ID: "example-go",
169166
Created: "2014-01-01T00:00:00UTC",
170167
Owner: "test",
171168
Updated: "2014-01-01T00:00:00UTC",
172-
URL: fmt.Sprintf("example-go.%s", u.Host),
173169
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
174170
}
175171

@@ -198,14 +194,11 @@ func TestAppsGet(t *testing.T) {
198194
server := httptest.NewServer(&handler)
199195
defer server.Close()
200196

201-
u, _ := url.Parse(server.URL)
202-
203197
expected := api.App{
204198
ID: "example-go",
205199
Created: "2014-01-01T00:00:00UTC",
206200
Owner: "test",
207201
Updated: "2014-01-01T00:00:00UTC",
208-
URL: fmt.Sprintf("example-go.%s", u.Host),
209202
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
210203
}
211204

@@ -277,15 +270,12 @@ func TestAppsList(t *testing.T) {
277270
server := httptest.NewServer(&handler)
278271
defer server.Close()
279272

280-
u, _ := url.Parse(server.URL)
281-
282273
expected := api.Apps{
283274
{
284275
ID: "example-go",
285276
Created: "2014-01-01T00:00:00UTC",
286277
Owner: "test",
287278
Updated: "2014-01-01T00:00:00UTC",
288-
URL: fmt.Sprintf("example-go.%s", u.Host),
289279
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
290280
},
291281
}

0 commit comments

Comments
 (0)