Skip to content

Commit 1c8a23d

Browse files
authored
elasticsearch: various test fixes (#4299)
* elasticsearch: tolerate context.Canceled in v8 test stream goroutine When StopWithin cancels the stream context, Run returns context.Canceled. Match the mssqlserver fix so the goroutine does not fail the test on expected shutdown. Fixes CON-438 * elasticsearch: tolerate context.Canceled in v9 test stream goroutine When StopWithin cancels the stream context, Run returns context.Canceled. Match the v8 fix so the goroutine does not fail the test on expected shutdown. Fixes CON-449
1 parent a19a935 commit 1c8a23d

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

internal/impl/elasticsearch/v8/integration_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
package elasticsearch
1515

1616
import (
17+
"context"
1718
"encoding/json"
19+
"errors"
1820
"fmt"
1921
"testing"
2022
"time"
@@ -79,7 +81,9 @@ elasticsearch_v8:
7981
require.NoError(t, err)
8082

8183
go func() {
82-
require.NoError(t, stream.Run(ctx))
84+
if err := stream.Run(ctx); err != nil && !errors.Is(err, context.Canceled) {
85+
t.Error(err)
86+
}
8387
}()
8488
defer func() {
8589
err := stream.StopWithin(time.Second * 3)

internal/impl/elasticsearch/v9/integration_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
package elasticsearch
1515

1616
import (
17+
"context"
1718
"encoding/json"
19+
"errors"
1820
"fmt"
1921
"testing"
2022
"time"
@@ -78,7 +80,9 @@ elasticsearch_v9:
7880
require.NoError(t, err)
7981

8082
go func() {
81-
require.NoError(t, stream.Run(ctx))
83+
if err := stream.Run(ctx); err != nil && !errors.Is(err, context.Canceled) {
84+
t.Error(err)
85+
}
8286
}()
8387
defer func() {
8488
err := stream.StopWithin(time.Second * 3)

0 commit comments

Comments
 (0)