mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Integration test flakes fixes.
This commit is contained in:
parent
e599f4a482
commit
a57e967d84
@ -240,9 +240,9 @@ func testBalancerUnderNetworkPartitionWatch(t *testing.T, isolateLeader bool) {
|
|||||||
clientv3test.MustWaitPinReady(t, watchCli)
|
clientv3test.MustWaitPinReady(t, watchCli)
|
||||||
t.Logf("successful connection with server: %v", target)
|
t.Logf("successful connection with server: %v", target)
|
||||||
|
|
||||||
// add all eps to list, so that when the original pined one fails
|
// We stick to the original endpoint, so when the one fails we don't switch
|
||||||
// the client can switch to other available eps
|
// under the cover to other available eps, but expose the failure to the
|
||||||
watchCli.SetEndpoints(eps...)
|
// caller (test assertion).
|
||||||
|
|
||||||
wch := watchCli.Watch(clientv3.WithRequireLeader(context.Background()), "foo", clientv3.WithCreatedNotify())
|
wch := watchCli.Watch(clientv3.WithRequireLeader(context.Background()), "foo", clientv3.WithCreatedNotify())
|
||||||
select {
|
select {
|
||||||
|
@ -26,12 +26,15 @@ import (
|
|||||||
"go.etcd.io/etcd/pkg/v3/testutil"
|
"go.etcd.io/etcd/pkg/v3/testutil"
|
||||||
"go.etcd.io/etcd/server/v3/embed"
|
"go.etcd.io/etcd/server/v3/embed"
|
||||||
"go.etcd.io/etcd/server/v3/etcdserver"
|
"go.etcd.io/etcd/server/v3/etcdserver"
|
||||||
|
"go.etcd.io/etcd/tests/v3/integration"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestSnapshotV3RestoreMultiMemberAdd ensures that multiple members
|
// TestSnapshotV3RestoreMultiMemberAdd ensures that multiple members
|
||||||
// can boot into the same cluster after being restored from a same
|
// 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.
|
// snapshot file, and also be able to add another member to the cluster.
|
||||||
func TestSnapshotV3RestoreMultiMemberAdd(t *testing.T) {
|
func TestSnapshotV3RestoreMultiMemberAdd(t *testing.T) {
|
||||||
|
integration.BeforeTest(t)
|
||||||
|
|
||||||
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
|
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
|
||||||
dbPath := createSnapshotFile(t, kvs)
|
dbPath := createSnapshotFile(t, kvs)
|
||||||
|
|
||||||
|
@ -29,12 +29,14 @@ import (
|
|||||||
"go.etcd.io/etcd/etcdctl/v3/snapshot"
|
"go.etcd.io/etcd/etcdctl/v3/snapshot"
|
||||||
"go.etcd.io/etcd/pkg/v3/testutil"
|
"go.etcd.io/etcd/pkg/v3/testutil"
|
||||||
"go.etcd.io/etcd/server/v3/embed"
|
"go.etcd.io/etcd/server/v3/embed"
|
||||||
|
"go.etcd.io/etcd/tests/v3/integration"
|
||||||
"go.uber.org/zap/zaptest"
|
"go.uber.org/zap/zaptest"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestSnapshotV3RestoreSingle tests single node cluster restoring
|
// TestSnapshotV3RestoreSingle tests single node cluster restoring
|
||||||
// from a snapshot file.
|
// from a snapshot file.
|
||||||
func TestSnapshotV3RestoreSingle(t *testing.T) {
|
func TestSnapshotV3RestoreSingle(t *testing.T) {
|
||||||
|
integration.BeforeTest(t)
|
||||||
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
|
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
|
||||||
dbPath := createSnapshotFile(t, kvs)
|
dbPath := createSnapshotFile(t, kvs)
|
||||||
defer os.RemoveAll(dbPath)
|
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
|
// can boot into the same cluster after being restored from a same
|
||||||
// snapshot file.
|
// snapshot file.
|
||||||
func TestSnapshotV3RestoreMulti(t *testing.T) {
|
func TestSnapshotV3RestoreMulti(t *testing.T) {
|
||||||
|
integration.BeforeTest(t)
|
||||||
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
|
kvs := []kv{{"foo1", "bar1"}, {"foo2", "bar2"}, {"foo3", "bar3"}}
|
||||||
dbPath := createSnapshotFile(t, kvs)
|
dbPath := createSnapshotFile(t, kvs)
|
||||||
defer os.RemoveAll(dbPath)
|
defer os.RemoveAll(dbPath)
|
||||||
@ -143,6 +146,7 @@ func TestSnapshotV3RestoreMulti(t *testing.T) {
|
|||||||
|
|
||||||
// TestCorruptedBackupFileCheck tests if we can correctly identify a corrupted backup file.
|
// TestCorruptedBackupFileCheck tests if we can correctly identify a corrupted backup file.
|
||||||
func TestCorruptedBackupFileCheck(t *testing.T) {
|
func TestCorruptedBackupFileCheck(t *testing.T) {
|
||||||
|
integration.BeforeTest(t)
|
||||||
dbPath := "testdata/corrupted_backup.db"
|
dbPath := "testdata/corrupted_backup.db"
|
||||||
if _, err := os.Stat(dbPath); err != nil {
|
if _, err := os.Stat(dbPath); err != nil {
|
||||||
t.Fatalf("test file [%s] does not exist: %v", dbPath, err)
|
t.Fatalf("test file [%s] does not exist: %v", dbPath, err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user