Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2015-06-03 06:52:39 -07:00
parent b8b16b78f4
commit 56349665b7
13 changed files with 334 additions and 197 deletions

View file

@ -780,11 +780,15 @@ func checkBodyHasErrorCodes(t *testing.T, msg string, resp *http.Response, error
counts[code] = 0
}
for _, err := range errs {
if _, ok := expected[err.Code]; !ok {
t.Fatalf("unexpected error code %v encountered during %s: %s ", err.Code, msg, string(p))
for _, e := range errs {
err, ok := e.(errcode.ErrorCoder)
if !ok {
t.Fatalf("not an ErrorCoder: %#v", e)
}
counts[err.Code]++
if _, ok := expected[err.ErrorCode()]; !ok {
t.Fatalf("unexpected error code %v encountered during %s: %s ", err.ErrorCode(), msg, string(p))
}
counts[err.ErrorCode()]++
}
// Ensure that counts of expected errors were all non-zero