fixes the unit tests to be more tolerant with error messages

Kubernetes-commit: 98948ad8092b41ebc08d50aa557b2d7ba5496e7d
This commit is contained in:
Rajalakshmi-Girish 2020-11-27 08:21:56 +00:00 committed by Kubernetes Publisher
parent c3e839ce63
commit c41f156212
1 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ func TestStrategicMergePatchInvalid(t *testing.T) {
if !apierrors.IsBadRequest(err) {
t.Errorf("expected HTTP status: BadRequest, got: %#v", apierrors.ReasonForError(err))
}
if err.Error() != expectedError {
if !strings.Contains(err.Error(), expectedError) {
t.Errorf("expected %#v, got %#v", expectedError, err.Error())
}
}
@ -171,7 +171,7 @@ func TestJSONPatch(t *testing.T) {
t.Errorf("%s: expect no error when applying json patch, but got %v", test.name, err)
continue
}
if err.Error() != test.expectedError {
if !strings.Contains(err.Error(), test.expectedError) {
t.Errorf("%s: expected error %v, but got %v", test.name, test.expectedError, err)
}
if test.expectedErrorType != apierrors.ReasonForError(err) {