tests: Move integration setup to separa framework package
This commit is contained in:
@ -21,14 +21,14 @@ import (
|
||||
|
||||
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
|
||||
"go.etcd.io/etcd/client/v3"
|
||||
"go.etcd.io/etcd/tests/v3/integration"
|
||||
integration2 "go.etcd.io/etcd/tests/v3/framework/integration"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func TestUserError(t *testing.T) {
|
||||
integration.BeforeTest(t)
|
||||
integration2.BeforeTest(t)
|
||||
|
||||
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1})
|
||||
clus := integration2.NewClusterV3(t, &integration2.ClusterConfig{Size: 1})
|
||||
defer clus.Terminate(t)
|
||||
|
||||
authapi := clus.RandClient()
|
||||
@ -55,9 +55,9 @@ func TestUserError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserErrorAuth(t *testing.T) {
|
||||
integration.BeforeTest(t)
|
||||
integration2.BeforeTest(t)
|
||||
|
||||
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1})
|
||||
clus := integration2.NewClusterV3(t, &integration2.ClusterConfig{Size: 1})
|
||||
defer clus.Terminate(t)
|
||||
|
||||
authapi := clus.RandClient()
|
||||
@ -75,16 +75,16 @@ func TestUserErrorAuth(t *testing.T) {
|
||||
DialOptions: []grpc.DialOption{grpc.WithBlock()},
|
||||
}
|
||||
cfg.Username, cfg.Password = "wrong-id", "123"
|
||||
if _, err := integration.NewClient(t, cfg); err != rpctypes.ErrAuthFailed {
|
||||
if _, err := integration2.NewClient(t, cfg); err != rpctypes.ErrAuthFailed {
|
||||
t.Fatalf("expected %v, got %v", rpctypes.ErrAuthFailed, err)
|
||||
}
|
||||
cfg.Username, cfg.Password = "root", "wrong-pass"
|
||||
if _, err := integration.NewClient(t, cfg); err != rpctypes.ErrAuthFailed {
|
||||
if _, err := integration2.NewClient(t, cfg); err != rpctypes.ErrAuthFailed {
|
||||
t.Fatalf("expected %v, got %v", rpctypes.ErrAuthFailed, err)
|
||||
}
|
||||
|
||||
cfg.Username, cfg.Password = "root", "123"
|
||||
authed, err := integration.NewClient(t, cfg)
|
||||
authed, err := integration2.NewClient(t, cfg)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -112,9 +112,9 @@ func authSetupRoot(t *testing.T, auth clientv3.Auth) {
|
||||
|
||||
// Client can connect to etcd even if they supply credentials and the server is in AuthDisable mode.
|
||||
func TestGetTokenWithoutAuth(t *testing.T) {
|
||||
integration.BeforeTest(t)
|
||||
integration2.BeforeTest(t)
|
||||
|
||||
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 2})
|
||||
clus := integration2.NewClusterV3(t, &integration2.ClusterConfig{Size: 2})
|
||||
defer clus.Terminate(t)
|
||||
|
||||
authapi := clus.RandClient()
|
||||
@ -135,7 +135,7 @@ func TestGetTokenWithoutAuth(t *testing.T) {
|
||||
Password: "123",
|
||||
}
|
||||
|
||||
client, err = integration.NewClient(t, cfg)
|
||||
client, err = integration2.NewClient(t, cfg)
|
||||
if err == nil {
|
||||
defer client.Close()
|
||||
}
|
||||
|
Reference in New Issue
Block a user