mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #16042 from serathius/epc-etcdctl
tests/e2e: Use epc.Etcdctl
This commit is contained in:
commit
693f25d6b9
@ -23,7 +23,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coreos/go-semver/semver"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"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) {
|
||||
c, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
assert.NoError(t, err)
|
||||
c := epc.Etcdctl()
|
||||
testutils.ExecuteWithTimeout(t, 20*time.Second, func() {
|
||||
err := c.DowngradeEnable(context.TODO(), ver.String())
|
||||
if err != nil {
|
||||
|
@ -117,9 +117,7 @@ func TestPeriodicCheckDetectsCorruption(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
assert.NoError(t, err)
|
||||
|
||||
cc := epc.Etcdctl()
|
||||
for i := 0; i < 10; i++ {
|
||||
err := cc.Put(ctx, testutil.PickKey(int64(i)), fmt.Sprint(i), config.PutOptions{})
|
||||
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())
|
||||
assert.NoError(t, err)
|
||||
|
||||
cc := epc.Etcdctl()
|
||||
for i := 0; i < 10; i++ {
|
||||
err := cc.Put(ctx, testutil.PickKey(int64(i)), fmt.Sprint(i), config.PutOptions{})
|
||||
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.
|
||||
t.Log("putting 10 values to the identical key...")
|
||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
require.NoError(t, err)
|
||||
cc := epc.Etcdctl()
|
||||
for i := 0; i < 10; i++ {
|
||||
err := cc.Put(ctx, "key", fmt.Sprint(i), config.PutOptions{})
|
||||
require.NoError(t, err, "error on put")
|
||||
|
@ -411,12 +411,9 @@ func TestEtcdHealthyWithTinySnapshotCatchupEntries(t *testing.T) {
|
||||
for i := 0; i < 10; i++ {
|
||||
clientId := i
|
||||
g.Go(func() error {
|
||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cc := epc.Etcdctl()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"time"
|
||||
|
||||
"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/e2e"
|
||||
@ -42,8 +41,7 @@ func TestWarningApplyDuration(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
require.NoError(t, err)
|
||||
cc := epc.Etcdctl()
|
||||
err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{})
|
||||
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())
|
||||
require.NoError(t, err)
|
||||
cc := epc.Etcdctl()
|
||||
err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{})
|
||||
assert.NoError(t, err, "error on put")
|
||||
|
||||
|
@ -115,14 +115,12 @@ func TestV2DeprecationSnapshotMatches(t *testing.T) {
|
||||
var snapshotCount uint64 = 10
|
||||
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, lastReleaseData, snapshotCount)
|
||||
oldMemberDataDir := epc.Procs[0].Config().DataDirPath
|
||||
cc1, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
assert.NoError(t, err)
|
||||
cc1 := epc.Etcdctl()
|
||||
members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount)
|
||||
assert.NoError(t, epc.Close())
|
||||
epc = runEtcdAndCreateSnapshot(t, e2e.CurrentVersion, currentReleaseData, snapshotCount)
|
||||
newMemberDataDir := epc.Procs[0].Config().DataDirPath
|
||||
cc2, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
assert.NoError(t, err)
|
||||
cc2 := epc.Etcdctl()
|
||||
members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount)
|
||||
assert.NoError(t, epc.Close())
|
||||
|
||||
@ -152,9 +150,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
|
||||
}
|
||||
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, dataDir, 10)
|
||||
|
||||
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
assert.NoError(t, err)
|
||||
|
||||
cc := epc.Etcdctl()
|
||||
lastReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
|
||||
assert.NoError(t, err)
|
||||
|
||||
@ -169,8 +165,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
|
||||
epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, e2e.WithConfig(cfg))
|
||||
assert.NoError(t, err)
|
||||
|
||||
cc, err = e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC())
|
||||
assert.NoError(t, err)
|
||||
cc = epc.Etcdctl()
|
||||
currentReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user