Integration test flakes fixes.

This commit is contained in:
Piotr Tabor 2021-03-16 16:08:18 +01:00
parent e599f4a482
commit a57e967d84
3 changed files with 10 additions and 3 deletions

View File

@ -240,9 +240,9 @@ func testBalancerUnderNetworkPartitionWatch(t *testing.T, isolateLeader bool) {
clientv3test.MustWaitPinReady(t, watchCli)
t.Logf("successful connection with server: %v", target)
// add all eps to list, so that when the original pined one fails
// the client can switch to other available eps
watchCli.SetEndpoints(eps...)
// We stick to the original endpoint, so when the one fails we don't switch
// under the cover to other available eps, but expose the failure to the
// caller (test assertion).
wch := watchCli.Watch(clientv3.WithRequireLeader(context.Background()), "foo", clientv3.WithCreatedNotify())
select {

View File

@ -26,12 +26,15 @@ import (
"go.etcd.io/etcd/pkg/v3/testutil"
"go.etcd.io/etcd/server/v3/embed"
"go.etcd.io/etcd/server/v3/etcdserver"
"go.etcd.io/etcd/tests/v3/integration"
)
// TestSnapshotV3RestoreMultiMemberAdd ensures that multiple members
// can boot into the same cluster after being restored from a same
// snapshot file, and also be able to add another member to the cluster.
func TestSnapshotV3RestoreMultiMemberAdd(t *testing.T) {
integration.BeforeTest(t)
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
dbPath := createSnapshotFile(t, kvs)

View File

@ -29,12 +29,14 @@ import (
"go.etcd.io/etcd/etcdctl/v3/snapshot"
"go.etcd.io/etcd/pkg/v3/testutil"
"go.etcd.io/etcd/server/v3/embed"
"go.etcd.io/etcd/tests/v3/integration"
"go.uber.org/zap/zaptest"
)
// TestSnapshotV3RestoreSingle tests single node cluster restoring
// from a snapshot file.
func TestSnapshotV3RestoreSingle(t *testing.T) {
integration.BeforeTest(t)
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
dbPath := createSnapshotFile(t, kvs)
defer os.RemoveAll(dbPath)
@ -106,6 +108,7 @@ func TestSnapshotV3RestoreSingle(t *testing.T) {
// can boot into the same cluster after being restored from a same
// snapshot file.
func TestSnapshotV3RestoreMulti(t *testing.T) {
integration.BeforeTest(t)
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
dbPath := createSnapshotFile(t, kvs)
defer os.RemoveAll(dbPath)
@ -143,6 +146,7 @@ func TestSnapshotV3RestoreMulti(t *testing.T) {
// TestCorruptedBackupFileCheck tests if we can correctly identify a corrupted backup file.
func TestCorruptedBackupFileCheck(t *testing.T) {
integration.BeforeTest(t)
dbPath := "testdata/corrupted_backup.db"
if _, err := os.Stat(dbPath); err != nil {
t.Fatalf("test file [%s] does not exist: %v", dbPath, err)