diff --git a/tests/common/auth_util.go b/tests/common/auth_util.go index f130c0c95..1a78a19cf 100644 --- a/tests/common/auth_util.go +++ b/tests/common/auth_util.go @@ -19,8 +19,8 @@ import ( "fmt" clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/framework" "go.etcd.io/etcd/tests/v3/framework/config" + intf "go.etcd.io/etcd/tests/v3/framework/interfaces" ) type authRole struct { @@ -36,7 +36,7 @@ type authUser struct { role string } -func createRoles(c framework.Client, roles []authRole) error { +func createRoles(c intf.Client, roles []authRole) error { for _, r := range roles { // add role if _, err := c.RoleAdd(context.TODO(), r.role); err != nil { @@ -52,7 +52,7 @@ func createRoles(c framework.Client, roles []authRole) error { return nil } -func createUsers(c framework.Client, users []authUser) error { +func createUsers(c intf.Client, users []authUser) error { for _, u := range users { // add user if _, err := c.UserAdd(context.TODO(), u.user, u.pass, config.UserAddOptions{}); err != nil { @@ -68,7 +68,7 @@ func createUsers(c framework.Client, users []authUser) error { return nil } -func setupAuth(c framework.Client, roles []authRole, users []authUser) error { +func setupAuth(c intf.Client, roles []authRole, users []authUser) error { // create roles if err := createRoles(c, roles); err != nil { return err diff --git a/tests/common/maintenance_auth_test.go b/tests/common/maintenance_auth_test.go index 61277f512..30434e6a6 100644 --- a/tests/common/maintenance_auth_test.go +++ b/tests/common/maintenance_auth_test.go @@ -22,8 +22,8 @@ import ( "github.com/stretchr/testify/require" clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/framework" "go.etcd.io/etcd/tests/v3/framework/config" + intf "go.etcd.io/etcd/tests/v3/framework/interfaces" "go.etcd.io/etcd/tests/v3/framework/testutils" ) @@ -47,7 +47,7 @@ func TestDefragmentWithUserAuth(t *testing.T) { } func testDefragmentWithAuth(t *testing.T, expectConnectionError, expectOperationError bool, opts ...config.ClientOption) { - testMaintenanceOperationWithAuth(t, expectConnectionError, expectOperationError, func(ctx context.Context, cc framework.Client) error { + testMaintenanceOperationWithAuth(t, expectConnectionError, expectOperationError, func(ctx context.Context, cc intf.Client) error { return cc.Defragment(ctx, config.DefragOption{Timeout: 10 * time.Second}) }, opts...) } @@ -96,7 +96,7 @@ func TestHashKVWithUserAuth(t *testing.T) { } func testHashKVWithAuth(t *testing.T, expectConnectionError, expectOperationError bool, opts ...config.ClientOption) { - testMaintenanceOperationWithAuth(t, expectConnectionError, expectOperationError, func(ctx context.Context, cc framework.Client) error { + testMaintenanceOperationWithAuth(t, expectConnectionError, expectOperationError, func(ctx context.Context, cc intf.Client) error { _, err := cc.HashKV(ctx, 0) return err }, opts...) @@ -170,13 +170,13 @@ func TestStatusWithUserAuth(t *testing.T) { } func testStatusWithAuth(t *testing.T, expectConnectionError, expectOperationError bool, opts ...config.ClientOption) { - testMaintenanceOperationWithAuth(t, expectConnectionError, expectOperationError, func(ctx context.Context, cc framework.Client) error { + testMaintenanceOperationWithAuth(t, expectConnectionError, expectOperationError, func(ctx context.Context, cc intf.Client) error { _, err := cc.Status(ctx) return err }, opts...) } -func setupAuthForMaintenanceTest(c framework.Client) error { +func setupAuthForMaintenanceTest(c intf.Client) error { roles := []authRole{ { role: "role0", @@ -201,7 +201,7 @@ func setupAuthForMaintenanceTest(c framework.Client) error { return setupAuth(c, roles, users) } -func testMaintenanceOperationWithAuth(t *testing.T, expectConnectError, expectOperationError bool, f func(context.Context, framework.Client) error, opts ...config.ClientOption) { +func testMaintenanceOperationWithAuth(t *testing.T, expectConnectError, expectOperationError bool, f func(context.Context, intf.Client) error, opts ...config.ClientOption) { testRunner.BeforeTest(t) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -209,7 +209,7 @@ func testMaintenanceOperationWithAuth(t *testing.T, expectConnectError, expectOp clus := testRunner.NewCluster(ctx, t) defer clus.Close() - cc := framework.MustClient(clus.Client()) + cc := testutils.MustClient(clus.Client()) err := setupAuthForMaintenanceTest(cc) require.NoError(t, err)