Skip to content

Commit

Permalink
Merge pull request etcd-io#17235 from fuweid/fix-17223
Browse files Browse the repository at this point in the history
integration: deflake TestMaintenanceSnapshotCancel
  • Loading branch information
ahrtr authored Jan 14, 2024
2 parents 9ded10e + fdf1e28 commit c8b4b16
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/integration/clientv3/maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"google.golang.org/grpc"
Expand Down Expand Up @@ -176,6 +177,12 @@ func TestMaintenanceSnapshotCancel(t *testing.T) {
}
defer rc1.Close()

// read 16 bytes to ensure that server opens snapshot
buf := make([]byte, 16)
n, err := rc1.Read(buf)
assert.NoError(t, err)
assert.Equal(t, 16, n)

cancel()
_, err = io.Copy(io.Discard, rc1)
if err != context.Canceled {
Expand Down

0 comments on commit c8b4b16

Please sign in to comment.