Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions crates/smoketests/tests/smoketests/cli/auth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! CLI auth command tests (`login` / `logout`)

use spacetimedb_smoketests::{require_local_server, Smoketest};
use spacetimedb_smoketests::{require_server_issued_login, Smoketest};
use std::fs;
use std::process::Output;
use std::time::{Duration, Instant};
Expand Down Expand Up @@ -34,7 +34,7 @@ fn write_config(test: &Smoketest, config: &toml::Table) {

#[test]
fn cli_logout_removes_cached_tokens() {
require_local_server!();
require_server_issued_login!();
let test = Smoketest::builder().autopublish(false).build();

let login = test.spacetime_cmd(&["login", "--server-issued-login", &test.server_url]);
Expand Down Expand Up @@ -72,7 +72,7 @@ fn cli_logout_removes_cached_tokens() {
#[test]
// Even if there's no web session, logout still removes the SpacetimeDB token
fn cli_logout_removes_cached_tokens_without_web_token() {
require_local_server!();
require_server_issued_login!();
let test = Smoketest::builder().autopublish(false).build();

let login = test.spacetime_cmd(&["login", "--server-issued-login", &test.server_url]);
Expand Down Expand Up @@ -101,7 +101,7 @@ fn cli_logout_removes_cached_tokens_without_web_token() {

#[test]
fn cli_logout_is_idempotent() {
require_local_server!();
require_server_issued_login!();
let test = Smoketest::builder().autopublish(false).build();

let login = test.spacetime_cmd(&["login", "--server-issued-login", &test.server_url]);
Expand All @@ -126,7 +126,7 @@ fn cli_logout_is_idempotent() {

#[test]
fn cli_direct_login_works_and_shows_core_messages() {
require_local_server!();
require_server_issued_login!();
let test = Smoketest::builder().autopublish(false).build();

let login = test.spacetime_cmd(&["login", "--server-issued-login", &test.server_url]);
Expand All @@ -150,7 +150,7 @@ fn cli_direct_login_works_and_shows_core_messages() {

#[test]
fn cli_logging_in_twice_works() {
require_local_server!();
require_server_issued_login!();
let test = Smoketest::builder().autopublish(false).build();

let first = test.spacetime_cmd(&["login", "--server-issued-login", &test.server_url]);
Expand Down
5 changes: 2 additions & 3 deletions crates/smoketests/tests/smoketests/cli/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! CLI list command tests

use spacetimedb_smoketests::{require_local_server, Smoketest};
use spacetimedb_smoketests::{random_string, Smoketest};
use std::process::Output;

fn output_stdout(output: &Output) -> String {
Expand All @@ -22,13 +22,12 @@ fn assert_success(output: &Output, context: &str) {

#[test]
fn cli_list_shows_database_names_and_identities() {
require_local_server!();
let mut test = Smoketest::builder()
.precompiled_module("noop")
.autopublish(false)
.build();

let primary_name = format!("list-db-{}", std::process::id());
let primary_name = format!("list-db-{}", random_string());
let alias_name = format!("{primary_name}-alias");
let second_alias_name = format!("{primary_name}-alt");
let identity = test.publish().name(&primary_name).run().unwrap();
Expand Down
13 changes: 7 additions & 6 deletions crates/smoketests/tests/smoketests/cli/publish.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! CLI publish command tests

use spacetimedb_smoketests::{patch_module_cargo_to_local_bindings, require_local_server, Smoketest};
use spacetimedb_smoketests::{patch_module_cargo_to_local_bindings, random_string, Smoketest};

#[test]
fn cli_can_publish_spacetimedb_on_disk() {
Expand Down Expand Up @@ -47,11 +47,10 @@ fn cli_can_publish_spacetimedb_on_disk() {
// e.g. when providing --delete-data, or when there's a conflict and --delete-data=on-conflict is provided.

fn migration_test(module_name: &str, republish_args: &[&str], expect_success: bool) {
// This only requires a local server because the module names are static
require_local_server!();

let test = Smoketest::builder().autopublish(false).build();

let module_name = format!("{module_name}-{}", random_string());

let workspace_dir = cargo_metadata::MetadataCommand::new().exec().unwrap().workspace_root;
let dir = workspace_dir.join("modules").join("module-test");

Expand All @@ -63,7 +62,8 @@ fn migration_test(module_name: &str, republish_args: &[&str], expect_success: bo
&dir,
"--server",
&test.server_url,
module_name,
"--yes=remote",
&module_name,
])
.unwrap();

Expand All @@ -74,7 +74,8 @@ fn migration_test(module_name: &str, republish_args: &[&str], expect_success: bo
&dir,
"--server",
&test.server_url,
module_name,
"--yes=remote",
&module_name,
];
args.extend(republish_args);
let output = test.spacetime_cmd(&args);
Expand Down
6 changes: 1 addition & 5 deletions crates/smoketests/tests/smoketests/servers.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
use regex::Regex;
use spacetimedb_smoketests::{require_local_server, Smoketest};
use spacetimedb_smoketests::Smoketest;

/// Verify that we can add and list server configurations
#[test]
fn test_servers() {
// This only covers local CLI config behavior, so it is not valuable to run
// against remote servers.
require_local_server!();

let test = Smoketest::builder().autopublish(false).build();

// Add a test server (local-only command, no --server flag needed)
Expand Down
Loading