Skip to content

Commit b4e3458

Browse files
committed
Fixed smoke tests
1 parent 8d9c123 commit b4e3458

8 files changed

Lines changed: 15 additions & 11 deletions

File tree

crates/bindings/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ The following changes are forbidden without a manual migration:
578578
-**Changing whether a table is used for [scheduling](#scheduled-reducers).** <!-- TODO: update this if we ever actually implement it... -->
579579
-**Adding `#[unique]` or `#[primary_key]` constraints.** This could result in existing tables being in an invalid state.
580580

581-
Currently, manual migration support is limited. The `spacetime publish --clear-database <DATABASE_IDENTITY>` command can be used to **COMPLETELY DELETE** and reinitialize your database, but naturally it should be used with EXTREME CAUTION.
581+
Currently, manual migration support is limited. The `spacetime publish --delete-data <DATABASE_IDENTITY>` command can be used to **COMPLETELY DELETE** and reinitialize your database, but naturally it should be used with EXTREME CAUTION.
582582

583583
[macro library]: https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/bindings-macro
584584
[module library]: https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/lib

crates/cli/src/common_args.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub fn confirmed() -> Arg {
4848
pub fn clear_database() -> Arg {
4949
Arg::new("clear-database")
5050
.long("delete-data")
51+
.alias("clear-database")
5152
.short('c')
5253
.num_args(0..=1)
5354
.value_parser(value_parser!(ClearMode))

crates/cli/src/subcommands/dev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ async fn generate_build_and_publish(
415415
"--project-path",
416416
project_path_str,
417417
"--yes",
418-
"--clear-database",
418+
"--delete-data",
419419
clear_flag,
420420
];
421421
publish_args.extend_from_slice(&["--server", server]);

crates/cli/src/subcommands/publish.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,19 @@ async fn apply_pre_publish_if_needed(
354354
{
355355
match pre {
356356
PrePublishResult::ManualMigrate(manual) => {
357-
if matches!(clear_database, ClearMode::OnConflict) {
357+
if clear_database == ClearMode::OnConflict {
358358
println!("{}", manual.reason);
359359
println!("Proceeding with database clear due to --delete-data=on-conflict.");
360360
}
361-
if matches!(clear_database, ClearMode::Never) {
361+
if clear_database == ClearMode::Never {
362362
println!("{}", manual.reason);
363363
println!("Aborting publish due to required manual migration.");
364364
anyhow::bail!("Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified.");
365365
}
366+
if clear_database == ClearMode::Always {
367+
println!("{}", manual.reason);
368+
println!("Proceeding with database clear due to --delete-data=always.");
369+
}
366370
}
367371
PrePublishResult::AutoMigrate(auto) => {
368372
println!("{}", auto.migrate_plan);

docs/docs/06-Server Module Languages/04-csharp-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ The following changes are forbidden without a manual migration:
10031003
-**Changing whether a table is used for [scheduling](#scheduled-reducers).** <!-- TODO: update this if we ever actually implement it... -->
10041004
-**Adding `[Unique]` or `[PrimaryKey]` constraints.** This could result in existing tables being in an invalid state.
10051005

1006-
Currently, manual migration support is limited. The `spacetime publish --clear-database <DATABASE_IDENTITY>` command can be used to **COMPLETELY DELETE** and reinitialize your database, but naturally it should be used with EXTREME CAUTION.
1006+
Currently, manual migration support is limited. The `spacetime publish --delete-data <DATABASE_IDENTITY>` command can be used to **COMPLETELY DELETE** and reinitialize your database, but naturally it should be used with EXTREME CAUTION.
10071007

10081008
## Other infrastructure
10091009

docs/docs/06-Server Module Languages/06-Typescript-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ The following deletes all data stored in the database.
573573
To fully reset your database and clear all data, run:
574574

575575
```bash
576-
spacetime publish --clear-database <DATABASE_NAME>
576+
spacetime publish --delete-data <DATABASE_NAME>
577577
# or
578578
spacetime publish -c <DATABASE_NAME>
579579
```

smoketests/tests/modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class UpdateModule(Smoketest):
6565

6666

6767
def test_module_update(self):
68-
"""Test publishing a module without the --clear-database option"""
68+
"""Test publishing a module without the --delete-data option"""
6969

7070
name = random_string()
7171

@@ -88,7 +88,7 @@ def test_module_update(self):
8888
self.write_module_code(self.MODULE_CODE_B)
8989
with self.assertRaises(CalledProcessError) as cm:
9090
self.publish_module(name, clear=False)
91-
self.assertIn("Error: Pre-publish check failed", cm.exception.stderr)
91+
self.assertIn("Error: Aborting because publishing would require manual migration", cm.exception.stderr)
9292

9393
# Check that the old module is still running by calling say_hello
9494
self.call("say_hello")

smoketests/tests/permissions.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ def test_publish(self):
5454
self.new_identity()
5555

5656
with self.assertRaises(Exception):
57-
# TODO: This raises for the wrong reason - `--clear-database` doesn't exist anymore!
58-
self.spacetime("publish", self.database_identity, "--project-path", self.project_path, "--clear-database", "--yes")
57+
self.spacetime("publish", self.database_identity, "--project-path", self.project_path, "--delete-data", "--yes")
5958

60-
# Check that this holds without `--clear-database`, too.
59+
# Check that this holds without `--delete-data`, too.
6160
with self.assertRaises(Exception):
6261
self.spacetime("publish", self.database_identity, "--project-path", self.project_path, "--yes")
6362

0 commit comments

Comments
 (0)