Skip to content

Commit

Permalink
[Integration testing] Remove AltErr and only expect 400 from ES bulk …
Browse files Browse the repository at this point in the history
…API (#4012)

* Remove AltErr

* Fixed error type
  • Loading branch information
ycombinator authored Oct 22, 2024
1 parent deefa2d commit 1ae9ab6
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions internal/pkg/bulk/bulk_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ func TestBulkCreate(t *testing.T) {
index, bulker := SetupIndexWithBulk(ctx, t, testPolicy, WithFlushThresholdCount(1))

tests := []struct {
Name string
Index string
ID string
Err error
AltErr error // FIXME: workaround until https://elasticco.atlassian.net/browse/ES-9711 is resolved
Name string
Index string
ID string
Err error
}{
{
Name: "Empty Id",
Expand Down Expand Up @@ -70,10 +69,6 @@ func TestBulkCreate(t *testing.T) {
Name: "Invalid utf-8",
Index: string([]byte{0xfe, 0xfe, 0xff, 0xff}),
Err: es.ErrElastic{
Status: 500,
Type: "json_parse_exception",
},
AltErr: es.ErrElastic{
Status: 400,
Type: "parse_exception",
},
Expand Down Expand Up @@ -105,9 +100,7 @@ func TestBulkCreate(t *testing.T) {
// Create
id, err := bulker.Create(ctx, test.Index, test.ID, sampleData)
if !EqualElastic(test.Err, err) {
if test.AltErr == nil || !EqualElastic(test.AltErr, err) {
t.Fatalf("expected error: %+v (alt: %+v), got: %+v", test.Err, test.AltErr, err)
}
t.Fatalf("expected error: %+v, got: %+v", test.Err, err)
}
if err != nil {
return
Expand Down

0 comments on commit 1ae9ab6

Please sign in to comment.