Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
fix(builder): the value could be a number
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored and mboersma committed Dec 16, 2014
1 parent a0d23ec commit 962a181
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
18 changes: 9 additions & 9 deletions builder/types.go
Expand Up @@ -38,15 +38,15 @@ type BuildHookResponse struct {

// Config represents a Deis application's configuration.
type Config struct {
Owner string `json:"owner"`
App string `json:"app"`
Values map[string]string `json:"values"`
Memory map[string]string `json:"memory"`
CPU map[string]string `json:"cpu"`
Tags map[string]string `json:"tags"`
UUID string `json:"uuid"`
Created DeisTime `json:"created"`
Updated DeisTime `json:"updated"`
Owner string `json:"owner"`
App string `json:"app"`
Values map[string]interface{} `json:"values"`
Memory map[string]string `json:"memory"`
CPU map[string]int `json:"cpu"`
Tags map[string]string `json:"tags"`
UUID string `json:"uuid"`
Created DeisTime `json:"created"`
Updated DeisTime `json:"updated"`
}

// DeisTime represents the standard datetime format used across the platform.
Expand Down
12 changes: 10 additions & 2 deletions builder/utils_test.go
Expand Up @@ -59,7 +59,7 @@ func TestParseConfigGood(t *testing.T) {
resp := &http.Response{
Body: &ClosingBuffer{bytes.NewBufferString(`{"owner": "test",
"app": "example-go",
"values": {"FOO": "bar"},
"values": {"FOO": "bar", "CAR": 1234},
"memory": {},
"cpu": {},
"tags": {},
Expand All @@ -76,7 +76,15 @@ func TestParseConfigGood(t *testing.T) {
}

if config.Values["FOO"] != "bar" {
t.Errorf("expected FOO='bar', got FOO='%s'", config.Values["FOO"])
t.Errorf("expected FOO='bar', got FOO='%v'", config.Values["FOO"])
}

if car, ok := config.Values["CAR"].(float64); ok {
if car != 1234 {
t.Errorf("expected CAR=1234, got CAR=%d", config.Values["CAR"])
}
} else {
t.Error("expected CAR to be of type float64")
}
}

Expand Down

0 comments on commit 962a181

Please sign in to comment.