Skip to content

Commit

Permalink
Add Error parsing test
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com>
  • Loading branch information
Jakob3xD committed Mar 15, 2023
1 parent 79bb7cc commit 531d416
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions opensearchapi/opensearchapi_response_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ func TestAPIResponse(t *testing.T) {
if !errors.As(err, &errTest) {
t.Errorf("Expected error to be of type opensearchapi.Error: %T", err)
}
if errTest.Status != 400 ||
errTest.Err.Reason != "index [test/HU2mN_RMRXGcS38j3yV-VQ] already exists" ||
errTest.Err.Type != "resource_already_exists_exception" ||
len(errTest.Err.RootCause) != 1 ||
errTest.Err.RootCause[0].Type != "resource_already_exists_exception" ||
errTest.Err.RootCause[0].Reason != "index [test/HU2mN_RMRXGcS38j3yV-VQ] already exists" {

t.Errorf("Reponse Error was not parsed correctly")
}
})

t.Run("Warnings", func(t *testing.T) {
Expand Down

0 comments on commit 531d416

Please sign in to comment.