diff --git a/tests/e2e/ctl_v3_auth_test.go b/tests/e2e/ctl_v3_auth_test.go index 928687d8424f..1328b75d46fc 100644 --- a/tests/e2e/ctl_v3_auth_test.go +++ b/tests/e2e/ctl_v3_auth_test.go @@ -66,6 +66,9 @@ func TestCtlV3AuthCertCNAndUsername(t *testing.T) { testCtl(t, authTestCertCNAndUsername, withCfg(configClientTLSCertAuth)) } func TestCtlV3AuthJWTExpire(t *testing.T) { testCtl(t, authTestJWTExpire, withCfg(configJWT)) } +func TestCtlV3AuthCertCNAndUsernameNoPassword(t *testing.T) { + testCtl(t, authTestCertCNAndUsernameNoPassword, withCfg(configClientTLSCertAuth)) +} func authEnableTest(cx ctlCtx) { if err := authEnable(cx); err != nil { @@ -1030,7 +1033,7 @@ func authTestEndpointHealth(cx ctlCtx) { } } -func authTestCertCNAndUsername(cx ctlCtx) { +func certCNAndUsername(cx ctlCtx, noPassword bool) { if err := authEnable(cx); err != nil { cx.t.Fatal(err) } @@ -1038,8 +1041,14 @@ func authTestCertCNAndUsername(cx ctlCtx) { cx.user, cx.pass = "root", "root" authSetupTestUser(cx) - if err := ctlV3User(cx, []string{"add", "example.com", "--interactive=false"}, "User example.com created", []string{""}); err != nil { - cx.t.Fatal(err) + if noPassword { + if err := ctlV3User(cx, []string{"add", "example.com", "--no-password"}, "User example.com created", []string{""}); err != nil { + cx.t.Fatal(err) + } + } else { + if err := ctlV3User(cx, []string{"add", "example.com", "--interactive=false"}, "User example.com created", []string{""}); err != nil { + cx.t.Fatal(err) + } } if err := spawnWithExpect(append(cx.PrefixArgs(), "role", "add", "test-role-cn"), "Role test-role-cn created"); err != nil { cx.t.Fatal(err) @@ -1082,6 +1091,14 @@ func authTestCertCNAndUsername(cx ctlCtx) { } } +func authTestCertCNAndUsername(cx ctlCtx) { + certCNAndUsername(cx, false) +} + +func authTestCertCNAndUsernameNoPassword(cx ctlCtx) { + certCNAndUsername(cx, true) +} + func authTestJWTExpire(cx ctlCtx) { if err := authEnable(cx); err != nil { cx.t.Fatal(err) diff --git a/tests/e2e/ctl_v3_user_test.go b/tests/e2e/ctl_v3_user_test.go index a6107db2033d..b282716c874d 100644 --- a/tests/e2e/ctl_v3_user_test.go +++ b/tests/e2e/ctl_v3_user_test.go @@ -78,6 +78,12 @@ func userAddTest(cx ctlCtx) { expectedStr: "user name already exists", stdIn: []string{"password"}, }, + // Adds a user without password. + { + args: []string{"add", "userwopasswd", "--no-password"}, + expectedStr: "User userwopasswd created", + stdIn: []string{}, + }, } for i, cmd := range cmdSet {