mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests/e2e: Use epc.Etcdctl
Signed-off-by: Marek Siarkowicz <serathius@users.noreply.github.com>
This commit is contained in:
parent
a708bed336
commit
b80fb0a1ce
@ -23,7 +23,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/go-semver/semver"
|
"github.com/coreos/go-semver/semver"
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
@ -155,8 +154,7 @@ func startEtcd(t *testing.T, ep e2e.EtcdProcess, execPath string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func downgradeEnable(t *testing.T, epc *e2e.EtcdProcessCluster, ver *semver.Version) {
|
func downgradeEnable(t *testing.T, epc *e2e.EtcdProcessCluster, ver *semver.Version) {
|
||||||
c, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
c := epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
testutils.ExecuteWithTimeout(t, 20*time.Second, func() {
|
testutils.ExecuteWithTimeout(t, 20*time.Second, func() {
|
||||||
err := c.DowngradeEnable(context.TODO(), ver.String())
|
err := c.DowngradeEnable(context.TODO(), ver.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -117,9 +117,7 @@ func TestPeriodicCheckDetectsCorruption(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
err := cc.Put(ctx, testutil.PickKey(int64(i)), fmt.Sprint(i), config.PutOptions{})
|
err := cc.Put(ctx, testutil.PickKey(int64(i)), fmt.Sprint(i), config.PutOptions{})
|
||||||
assert.NoError(t, err, "error on put")
|
assert.NoError(t, err, "error on put")
|
||||||
@ -165,9 +163,7 @@ func TestCompactHashCheckDetectCorruption(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
err := cc.Put(ctx, testutil.PickKey(int64(i)), fmt.Sprint(i), config.PutOptions{})
|
err := cc.Put(ctx, testutil.PickKey(int64(i)), fmt.Sprint(i), config.PutOptions{})
|
||||||
assert.NoError(t, err, "error on put")
|
assert.NoError(t, err, "error on put")
|
||||||
@ -236,8 +232,7 @@ func TestCompactHashCheckDetectCorruptionInterrupt(t *testing.T) {
|
|||||||
|
|
||||||
// Put 10 identical keys to the cluster, so that the compaction will drop some stale values.
|
// Put 10 identical keys to the cluster, so that the compaction will drop some stale values.
|
||||||
t.Log("putting 10 values to the identical key...")
|
t.Log("putting 10 values to the identical key...")
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
require.NoError(t, err)
|
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
err := cc.Put(ctx, "key", fmt.Sprint(i), config.PutOptions{})
|
err := cc.Put(ctx, "key", fmt.Sprint(i), config.PutOptions{})
|
||||||
require.NoError(t, err, "error on put")
|
require.NoError(t, err, "error on put")
|
||||||
|
@ -411,12 +411,9 @@ func TestEtcdHealthyWithTinySnapshotCatchupEntries(t *testing.T) {
|
|||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
clientId := i
|
clientId := i
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
for j := 0; j < 100; j++ {
|
for j := 0; j < 100; j++ {
|
||||||
if err = cc.Put(ctx, "foo", fmt.Sprintf("bar%d", clientId), config.PutOptions{}); err != nil {
|
if err := cc.Put(ctx, "foo", fmt.Sprintf("bar%d", clientId), config.PutOptions{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
|
|
||||||
"go.etcd.io/etcd/tests/v3/framework/config"
|
"go.etcd.io/etcd/tests/v3/framework/config"
|
||||||
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
||||||
@ -42,8 +41,7 @@ func TestWarningApplyDuration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
require.NoError(t, err)
|
|
||||||
err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{})
|
err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{})
|
||||||
assert.NoError(t, err, "error on put")
|
assert.NoError(t, err, "error on put")
|
||||||
|
|
||||||
@ -70,8 +68,7 @@ func TestExperimentalWarningApplyDuration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
require.NoError(t, err)
|
|
||||||
err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{})
|
err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{})
|
||||||
assert.NoError(t, err, "error on put")
|
assert.NoError(t, err, "error on put")
|
||||||
|
|
||||||
|
@ -115,14 +115,12 @@ func TestV2DeprecationSnapshotMatches(t *testing.T) {
|
|||||||
var snapshotCount uint64 = 10
|
var snapshotCount uint64 = 10
|
||||||
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, lastReleaseData, snapshotCount)
|
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, lastReleaseData, snapshotCount)
|
||||||
oldMemberDataDir := epc.Procs[0].Config().DataDirPath
|
oldMemberDataDir := epc.Procs[0].Config().DataDirPath
|
||||||
cc1, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc1 := epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount)
|
members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount)
|
||||||
assert.NoError(t, epc.Close())
|
assert.NoError(t, epc.Close())
|
||||||
epc = runEtcdAndCreateSnapshot(t, e2e.CurrentVersion, currentReleaseData, snapshotCount)
|
epc = runEtcdAndCreateSnapshot(t, e2e.CurrentVersion, currentReleaseData, snapshotCount)
|
||||||
newMemberDataDir := epc.Procs[0].Config().DataDirPath
|
newMemberDataDir := epc.Procs[0].Config().DataDirPath
|
||||||
cc2, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc2 := epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount)
|
members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount)
|
||||||
assert.NoError(t, epc.Close())
|
assert.NoError(t, epc.Close())
|
||||||
|
|
||||||
@ -152,9 +150,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
|
|||||||
}
|
}
|
||||||
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, dataDir, 10)
|
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, dataDir, 10)
|
||||||
|
|
||||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc := epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
lastReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
|
lastReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
@ -169,8 +165,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
|
|||||||
epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, e2e.WithConfig(cfg))
|
epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, e2e.WithConfig(cfg))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
cc, err = e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
cc = epc.Etcdctl()
|
||||||
assert.NoError(t, err)
|
|
||||||
currentReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
|
currentReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user