Skip to content

Commit

Permalink
100% test coverage of config.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaals committed Nov 16, 2015
1 parent 9224c1b commit 2d765d4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions config_test.go
Expand Up @@ -20,3 +20,29 @@ func TestInvalidConfig(t *testing.T) {
t.Errorf("No error presented when invalid configuration is loaded")
}
}

func TestInvalidYAMLConfig(t *testing.T) {
_, err := loadConfig("README.md")
if err == nil {
t.Errorf("No error presented when invalid configuration is loaded")
}
}

func TestListMachines(t *testing.T) {
c, _ := loadConfig("config.yaml")
machines, err := c.listMachines()
if err != nil {
t.Errorf("Failed to list machines")
}
if machines[0] == "my-service.example.com" {
t.Errorf("expected my-service.example.com in machine list")
}
}

func TestListMachinesWithInvalidPath(t *testing.T) {
c := Config{MachinePath: "invalid"}
_, err := c.listMachines()
if err == nil {
t.Errorf("Invalid machine path should throw errors")
}
}

0 comments on commit 2d765d4

Please sign in to comment.