Skip to content

Commit cdf60c1

Browse files
committed
[bot/fix-login-token-fallthrough]: move test
1 parent 0b146ff commit cdf60c1

3 files changed

Lines changed: 24 additions & 28 deletions

File tree

crates/smoketests/tests/smoketests/cli/auth.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,27 @@ fn cli_logging_in_twice_works() {
170170
second_stdout
171171
);
172172
}
173+
174+
/// Test that `spacetime login --token <token>` exits immediately after saving
175+
/// the token, without falling through to the interactive web login flow.
176+
///
177+
/// Without the fix in PR #4579, the command would fall through to the web
178+
/// login flow, which tries to open a browser and fails in CI.
179+
#[test]
180+
fn cli_login_with_token() {
181+
let test = Smoketest::builder().autopublish(false).build();
182+
183+
// A dummy token that won't decode to a valid identity.
184+
let output = test.spacetime_cmd(&["login", "--token", "test-dummy-token"]);
185+
let stdout = String::from_utf8_lossy(&output.stdout);
186+
let stderr = String::from_utf8_lossy(&output.stderr);
187+
188+
assert!(
189+
output.status.success(),
190+
"Expected `spacetime login --token` to succeed, but it failed.\nstdout: {stdout}\nstderr: {stderr}"
191+
);
192+
assert!(
193+
stdout.contains("Token saved."),
194+
"Expected 'Token saved.' in output, got: {stdout}"
195+
);
196+
}

crates/smoketests/tests/smoketests/login.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

crates/smoketests/tests/smoketests/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ mod domains;
1818
mod fail_initial_publish;
1919
mod filtering;
2020
mod http_egress;
21-
mod login;
2221
mod logs_level_filter;
2322
mod module_nested_op;
2423
mod modules;

0 commit comments

Comments
 (0)