From 46fe4b8e1c49e0da4e7284c781d02466cde00d68 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Thu, 25 Aug 2022 14:22:59 +0200 Subject: [PATCH] tests: Rename common client lease methods to match Signed-off-by: Marek Siarkowicz --- tests/common/lease_test.go | 6 +++--- tests/framework/e2e/etcdctl.go | 6 +++--- tests/framework/integration.go | 12 ------------ tests/framework/interface.go | 6 +++--- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/tests/common/lease_test.go b/tests/common/lease_test.go index ad7b7b090..7a424dc38 100644 --- a/tests/common/lease_test.go +++ b/tests/common/lease_test.go @@ -119,7 +119,7 @@ func TestLeaseGrantAndList(t *testing.T) { // or by hitting an up to date member. leases := []clientv3.LeaseStatus{} require.Eventually(t, func() bool { - resp, err := cc.LeaseList(ctx) + resp, err := cc.Leases(ctx) if err != nil { return false } @@ -193,7 +193,7 @@ func TestLeaseGrantKeepAliveOnce(t *testing.T) { leaseResp, err := cc.Grant(ctx, 2) require.NoError(t, err) - _, err = cc.LeaseKeepAliveOnce(ctx, leaseResp.ID) + _, err = cc.KeepAliveOnce(ctx, leaseResp.ID) require.NoError(t, err) time.Sleep(2 * time.Second) // Wait for the original lease to expire @@ -229,7 +229,7 @@ func TestLeaseGrantRevoke(t *testing.T) { require.NoError(t, err) require.Equal(t, int64(1), getResp.Count) - _, err = cc.LeaseRevoke(ctx, leaseResp.ID) + _, err = cc.Revoke(ctx, leaseResp.ID) require.NoError(t, err) ttlResp, err := cc.TimeToLive(ctx, leaseResp.ID, config.LeaseOption{}) diff --git a/tests/framework/e2e/etcdctl.go b/tests/framework/e2e/etcdctl.go index c08d51e63..e29c1c273 100644 --- a/tests/framework/e2e/etcdctl.go +++ b/tests/framework/e2e/etcdctl.go @@ -392,7 +392,7 @@ func (ctl *EtcdctlV3) Defragment(ctx context.Context, o config.DefragOption) err return err } -func (ctl *EtcdctlV3) LeaseList(ctx context.Context) (*clientv3.LeaseLeasesResponse, error) { +func (ctl *EtcdctlV3) Leases(ctx context.Context) (*clientv3.LeaseLeasesResponse, error) { args := ctl.cmdArgs("lease", "list", "-w", "json") cmd, err := SpawnCmd(args, nil) if err != nil { @@ -408,7 +408,7 @@ func (ctl *EtcdctlV3) LeaseList(ctx context.Context) (*clientv3.LeaseLeasesRespo return &resp, err } -func (ctl *EtcdctlV3) LeaseKeepAliveOnce(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) { +func (ctl *EtcdctlV3) KeepAliveOnce(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) { args := ctl.cmdArgs("lease", "keep-alive", strconv.FormatInt(int64(id), 16), "--once", "-w", "json") cmd, err := SpawnCmd(args, nil) if err != nil { @@ -424,7 +424,7 @@ func (ctl *EtcdctlV3) LeaseKeepAliveOnce(ctx context.Context, id clientv3.LeaseI return &resp, err } -func (ctl *EtcdctlV3) LeaseRevoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) { +func (ctl *EtcdctlV3) Revoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) { var resp clientv3.LeaseRevokeResponse err := ctl.spawnJsonCmd(ctx, &resp, "lease", "revoke", strconv.FormatInt(int64(id), 16)) return &resp, err diff --git a/tests/framework/integration.go b/tests/framework/integration.go index fed20d3d3..6ba1c9808 100644 --- a/tests/framework/integration.go +++ b/tests/framework/integration.go @@ -258,18 +258,6 @@ func (c integrationClient) TimeToLive(ctx context.Context, id clientv3.LeaseID, return c.Client.TimeToLive(ctx, id, leaseOpts...) } -func (c integrationClient) LeaseList(ctx context.Context) (*clientv3.LeaseLeasesResponse, error) { - return c.Client.Leases(ctx) -} - -func (c integrationClient) LeaseKeepAliveOnce(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) { - return c.Client.KeepAliveOnce(ctx, id) -} - -func (c integrationClient) LeaseRevoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) { - return c.Client.Revoke(ctx, id) -} - func (c integrationClient) UserAdd(ctx context.Context, name, password string, opts config.UserAddOptions) (*clientv3.AuthUserAddResponse, error) { return c.Client.UserAddWithOptions(ctx, name, password, &clientv3.UserAddOptions{ NoPassword: opts.NoPassword, diff --git a/tests/framework/interface.go b/tests/framework/interface.go index 7198fd3f5..f46c4819a 100644 --- a/tests/framework/interface.go +++ b/tests/framework/interface.go @@ -54,9 +54,9 @@ type Client interface { AlarmDisarm(context context.Context, alarmMember *clientv3.AlarmMember) (*clientv3.AlarmResponse, error) Grant(context context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error) TimeToLive(context context.Context, id clientv3.LeaseID, opts config.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error) - LeaseList(context context.Context) (*clientv3.LeaseLeasesResponse, error) - LeaseKeepAliveOnce(context context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) - LeaseRevoke(context context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) + Leases(context context.Context) (*clientv3.LeaseLeasesResponse, error) + KeepAliveOnce(context context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) + Revoke(context context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) UserAdd(context context.Context, name, password string, opts config.UserAddOptions) (*clientv3.AuthUserAddResponse, error) UserList(context context.Context) (*clientv3.AuthUserListResponse, error) UserDelete(context context.Context, name string) (*clientv3.AuthUserDeleteResponse, error)