Skip to content

Commit

Permalink
fixup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damnski committed Mar 18, 2021
1 parent 47829e3 commit d7e2294
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
9 changes: 9 additions & 0 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ type Config struct {
Org string
}

// Version carries around the API version information
type Version struct {
Version string
BuildStamp string
GitHash string
}

// Account is the configuration for an individual account
type Account struct {
LTMHost string
Expand All @@ -42,12 +49,14 @@ type Account struct {
Password string
}

/*
// Version carries around the API version information
type Version struct {
Version string
BuildStamp string
GitHash string
}
*/

// ReadConfig decodes the configuration from an io Reader
func ReadConfig(r io.Reader) (Config, error) {
Expand Down
34 changes: 18 additions & 16 deletions common/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ import (
var testConfig = []byte(
`{
"listenAddress": ":8000",
"account": {
"region": "us-east-1",
"akid": "key1",
"secret": "secret1",
"role": "uber-role",
"externalId": "foobar"
"accounts": {
"www.example.org": {
"ltmhost": "www.example.org",
"username": "user1",
"password": "1badpass",
"uploadpath": "/foobar"
}
},
"token": "SEKRET",
"logLevel": "info",
"logLevel": "infos",
"org": "test"
}`)

Expand All @@ -42,16 +43,17 @@ var brokenConfig = []byte(`{ "foobar": { "baz": "biz" }`)
func TestReadConfig(t *testing.T) {
expectedConfig := Config{
ListenAddress: ":8000",
Account: Account{
Region: "us-east-1",
Akid: "key1",
Secret: "secret1",
Role: "uber-role",
ExternalID: "foobar",
Token: "SEKRET",
LogLevel: "infos",
Org: "test",
Accounts: map[string]Account{
"www.example.org": Account{
LTMHost: "www.example.org",
Username: "user1",
Password: "1badpass",
UploadPath: "/foobar",
},
},
Token: "SEKRET",
LogLevel: "info",
Org: "test",
}

actualConfig, err := ReadConfig(bytes.NewReader(testConfig))
Expand Down
Empty file modified docker/import_config.sh
100644 → 100755
Empty file.

0 comments on commit d7e2294

Please sign in to comment.