| ... | ... |
@@ -245,9 +245,7 @@ func (o *LoginOptions) gatherAuthInfo() error {
|
| 245 | 245 |
|
| 246 | 246 |
o.Config = clientConfig |
| 247 | 247 |
|
| 248 |
- if key == o.StartingKubeConfig.CurrentContext {
|
|
| 249 |
- fmt.Fprintf(o.Out, "Logged into %q as %q using existing credentials.\n\n", o.Config.Host, o.Username) |
|
| 250 |
- } |
|
| 248 |
+ fmt.Fprintf(o.Out, "Logged into %q as %q using existing credentials.\n\n", o.Config.Host, o.Username) |
|
| 251 | 249 |
|
| 252 | 250 |
return nil |
| 253 | 251 |
} |
| ... | ... |
@@ -11,6 +11,18 @@ trap os::test::junit::reconcile_output EXIT |
| 11 | 11 |
|
| 12 | 12 |
os::test::junit::declare_suite_start "cmd/authentication" |
| 13 | 13 |
|
| 14 |
+# Logging in prints useful messages |
|
| 15 |
+os::test::junit::declare_suite_start "cmd/authentication/existing-credentials" |
|
| 16 |
+os::cmd::expect_success_and_text 'oc login -u user1 -p pw' 'Login successful' |
|
| 17 |
+os::cmd::expect_success_and_text 'oc login -u user2 -p pw' 'Login successful' |
|
| 18 |
+# Switching to another user using existing credentials informs you |
|
| 19 |
+os::cmd::expect_success_and_text 'oc login -u user1' 'Logged into ".*" as "user1" using existing credentials' |
|
| 20 |
+# Completing a login as the same user using existing credentials informs you |
|
| 21 |
+os::cmd::expect_success_and_text 'oc login -u user1' 'Logged into ".*" as "user1" using existing credentials' |
|
| 22 |
+# Return to the system:admin user |
|
| 23 |
+os::cmd::expect_success 'oc login -u system:admin -n cmd-authentication' |
|
| 24 |
+os::test::junit::declare_suite_end |
|
| 25 |
+ |
|
| 14 | 26 |
os::test::junit::declare_suite_start "cmd/authentication/scopedtokens" |
| 15 | 27 |
os::cmd::expect_success 'oadm policy add-role-to-user admin scoped-user' |
| 16 | 28 |
|