Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] Fix AuthEnable/Disable e2e test implementations #14608

Merged
merged 3 commits into from
Oct 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions tests/framework/e2e/etcdctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,33 @@ func (ctl *EtcdctlV3) AlarmDisarm(ctx context.Context, _ *clientv3.AlarmMember)
}

func (ctl *EtcdctlV3) AuthEnable(ctx context.Context) (*clientv3.AuthEnableResponse, error) {
var resp clientv3.AuthEnableResponse
err := ctl.spawnJsonCmd(ctx, &resp, "auth", "enable")
return &resp, err
args := []string{"auth", "enable"}
cmd, err := SpawnCmd(ctl.cmdArgs(args...), nil)
if err != nil {
return nil, err
}
defer cmd.Close()

_, err = cmd.ExpectWithContext(ctx, "Authentication Enabled")
if err != nil {
return nil, err
}
return &clientv3.AuthEnableResponse{}, nil
}

func (ctl *EtcdctlV3) AuthDisable(ctx context.Context) (*clientv3.AuthDisableResponse, error) {
var resp clientv3.AuthDisableResponse
err := ctl.spawnJsonCmd(ctx, &resp, "auth", "disable")
return &resp, err
args := []string{"auth", "disable"}
cmd, err := SpawnCmd(ctl.cmdArgs(args...), nil)
if err != nil {
return nil, err
}
defer cmd.Close()

_, err = cmd.ExpectWithContext(ctx, "Authentication Disabled")
if err != nil {
return nil, err
}
return &clientv3.AuthDisableResponse{}, nil
}

func (ctl *EtcdctlV3) AuthStatus(ctx context.Context) (*clientv3.AuthStatusResponse, error) {
Expand Down