Skip to content

Commit 239f79d

Browse files
committed
fix(builder): the value could be a number
1 parent d43f5e7 commit 239f79d

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

builder/types.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ type BuildHookResponse struct {
3838

3939
// Config represents a Deis application's configuration.
4040
type Config struct {
41-
Owner string `json:"owner"`
42-
App string `json:"app"`
43-
Values map[string]string `json:"values"`
44-
Memory map[string]string `json:"memory"`
45-
CPU map[string]string `json:"cpu"`
46-
Tags map[string]string `json:"tags"`
47-
UUID string `json:"uuid"`
48-
Created DeisTime `json:"created"`
49-
Updated DeisTime `json:"updated"`
41+
Owner string `json:"owner"`
42+
App string `json:"app"`
43+
Values map[string]interface{} `json:"values"`
44+
Memory map[string]string `json:"memory"`
45+
CPU map[string]int `json:"cpu"`
46+
Tags map[string]string `json:"tags"`
47+
UUID string `json:"uuid"`
48+
Created DeisTime `json:"created"`
49+
Updated DeisTime `json:"updated"`
5050
}
5151

5252
// DeisTime represents the standard datetime format used across the platform.

builder/utils_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestParseConfigGood(t *testing.T) {
5959
resp := &http.Response{
6060
Body: &ClosingBuffer{bytes.NewBufferString(`{"owner": "test",
6161
"app": "example-go",
62-
"values": {"FOO": "bar"},
62+
"values": {"FOO": "bar", "CAR": 1234},
6363
"memory": {},
6464
"cpu": {},
6565
"tags": {},
@@ -76,7 +76,15 @@ func TestParseConfigGood(t *testing.T) {
7676
}
7777

7878
if config.Values["FOO"] != "bar" {
79-
t.Errorf("expected FOO='bar', got FOO='%s'", config.Values["FOO"])
79+
t.Errorf("expected FOO='bar', got FOO='%v'", config.Values["FOO"])
80+
}
81+
82+
if car, ok := config.Values["CAR"].(float64); ok {
83+
if car != 1234 {
84+
t.Errorf("expected CAR=1234, got CAR=%d", config.Values["CAR"])
85+
}
86+
} else {
87+
t.Error("expected CAR to be of type float64")
8088
}
8189
}
8290

0 commit comments

Comments
 (0)