mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14693 from ahrtr/pipeline_failure_20221106
test: fix pipeline errors due to PRs conflict
This commit is contained in:
commit
e68acb1a95
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user