Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions validate/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ func TestJSONSchema(t *testing.T) {
v := &Validator{spec: tt.config}
errs := v.CheckJSONSchema()
if tt.error == "" {
assert.Equal(t, nil, errs)
return
if errs == nil {
return
}
t.Fatalf("expected no error, but got: %s", errs.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the code change. I can't see any relations between the change with your comment.

Copy link
Contributor Author

@wking wking Sep 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the code change.

If tt.error is an empty string, and CheckJSONSchema returns nil, then great, the test passes. This worked fine before, and still works fine after this commit.

If CheckJSONSchema raises an error, the old assert.Equal was rendering the unhelpful actual: *multierror.... With this commit, we get the useful * linux.rootfsPropagation... (or whatever the returned error happens to be.

I can't see any relations between the change with your comment.

The examples in the commit message / PR comment are from working up #476. There's not a great example to use for test-failure messages, because all of the tests in master pass ;).

}
merr, ok := errs.(*multierror.Error)
if !ok {
Expand Down