Skip to content

Commit

Permalink
Added some failing tests for the failing config loading when doing cdc
Browse files Browse the repository at this point in the history
  • Loading branch information
quii committed Apr 26, 2016
1 parent 5564138 commit 29dc70a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 0 additions & 3 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ func (a *application) loadConfig() (endpoints []mockingjay.FakeEndpoint, err err
if newMD5 := md5.Sum(configData); newMD5 != a.yamlMD5 {
a.yamlMD5 = newMD5
endpoints, err = a.mockingjayLoader(configData)
if err != nil {
return nil, err
}
}
return
}
Expand Down
17 changes: 16 additions & 1 deletion application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ func TestItFailsWhenTheConfigFileCantBeLoaded(t *testing.T) {
app := testApplication()
app.configLoader = failingIOUtil

_, err := app.CreateServer("mockingjay config path", "")
configPath := "mockingjay config path"
_, err := app.CreateServer(configPath, "")

assert.NotNil(t, err)
assert.Equal(t, err, errIOError)

compatErr := app.CheckCompatibility(configPath, "some url")
assert.NotNil(t, compatErr)
assert.Equal(t, err, errIOError)
}

func TestItFailsWhenTheConfigIsInvalid(t *testing.T) {
Expand All @@ -32,6 +37,16 @@ func TestItFailsWhenTheConfigIsInvalid(t *testing.T) {
assert.Equal(t, err, errMJLoaderError)
}

func TestCompatFailsWhenConfigIsInvalid(t *testing.T){
app := testApplication()
app.mockingjayLoader = failingMockingjayLoader

err := app.CheckCompatibility("mockingjay config path", "some url")

assert.NotNil(t, err, "Didnt get an error when the mockingjay config failed to load")
assert.Equal(t, err, errMJLoaderError)
}

func TestItFailsWhenTheMonkeyConfigIsInvalid(t *testing.T) {
app := testApplication()

Expand Down

0 comments on commit 29dc70a

Please sign in to comment.