diff --git a/opensearchapi/opensearchapi_response_internal_test.go b/opensearchapi/opensearchapi_response_internal_test.go index 2be9486bd..57fd6a96b 100644 --- a/opensearchapi/opensearchapi_response_internal_test.go +++ b/opensearchapi/opensearchapi_response_internal_test.go @@ -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) {