-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add C# SDK tests * Add memoization * Increase timeout * Mark module_bindings as LF * Regenerate from Rust again * Sort tables & reducers for determinism * cargo fmt * Lint & fmt fixups * Lint fixups * Allow dirs ending in .wasm
- Loading branch information
Showing
9 changed files
with
1,808 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
**/module_bindings/** linguist-generated=true | ||
**/module_bindings/** linguist-generated=true eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,139 @@ | ||
use spacetimedb_testing::sdk::Test; | ||
|
||
const MODULE: &str = "sdk-test"; | ||
const CLIENT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/test-client"); | ||
|
||
fn make_test(subcommand: &str) -> Test { | ||
Test::builder() | ||
.with_name(subcommand) | ||
.with_module(MODULE) | ||
.with_client(CLIENT) | ||
.with_language("rust") | ||
.with_bindings_dir("src/module_bindings") | ||
.with_compile_command("cargo build") | ||
.with_run_command(format!("cargo run -- {}", subcommand)) | ||
.build() | ||
} | ||
|
||
#[test] | ||
fn insert_primitive() { | ||
make_test("insert_primitive").run(); | ||
} | ||
|
||
#[test] | ||
fn delete_primitive() { | ||
make_test("delete_primitive").run(); | ||
} | ||
|
||
#[test] | ||
fn update_primitive() { | ||
make_test("update_primitive").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_identity() { | ||
make_test("insert_identity").run(); | ||
} | ||
|
||
#[test] | ||
fn delete_identity() { | ||
make_test("delete_identity").run(); | ||
} | ||
|
||
#[test] | ||
fn update_identity() { | ||
make_test("delete_identity").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_address() { | ||
make_test("insert_address").run(); | ||
} | ||
|
||
#[test] | ||
fn delete_address() { | ||
make_test("delete_address").run(); | ||
} | ||
|
||
#[test] | ||
fn update_address() { | ||
make_test("delete_address").run(); | ||
} | ||
|
||
#[test] | ||
fn on_reducer() { | ||
make_test("on_reducer").run(); | ||
} | ||
|
||
#[test] | ||
fn fail_reducer() { | ||
make_test("fail_reducer").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_vec() { | ||
make_test("insert_vec").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_simple_enum() { | ||
make_test("insert_simple_enum").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_enum_with_payload() { | ||
make_test("insert_enum_with_payload").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_long_table() { | ||
make_test("insert_long_table").run(); | ||
} | ||
|
||
#[test] | ||
fn resubscribe() { | ||
make_test("resubscribe").run(); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn should_fail() { | ||
make_test("should_fail").run(); | ||
} | ||
|
||
#[test] | ||
fn reauth() { | ||
make_test("reauth_part_1").run(); | ||
make_test("reauth_part_2").run(); | ||
} | ||
|
||
#[test] | ||
fn reconnect_same_address() { | ||
make_test("reconnect_same_address").run(); | ||
} | ||
|
||
#[test] | ||
fn connect_disconnect_callbacks() { | ||
Test::builder() | ||
.with_name("connect_disconnect_callback") | ||
.with_module("sdk-test-connect-disconnect") | ||
.with_client(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/connect_disconnect_client")) | ||
.with_language("rust") | ||
.with_bindings_dir("src/module_bindings") | ||
.with_compile_command("cargo build") | ||
.with_run_command("cargo run") | ||
.build() | ||
.run(); | ||
} | ||
|
||
#[test] | ||
fn connect_disconnect_callbacks_csharp() { | ||
Test::builder() | ||
.with_name("connect_disconnect_callback_csharp") | ||
.with_module("sdk-test-connect-disconnect-cs") | ||
.with_client(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/connect_disconnect_client")) | ||
.with_language("rust") | ||
.with_bindings_dir("src/module_bindings") | ||
.with_compile_command("cargo build") | ||
.with_run_command("cargo run") | ||
.build() | ||
.run(); | ||
} | ||
macro_rules! declare_tests_with_suffix { | ||
($lang:ident, $suffix:literal) => { | ||
mod $lang { | ||
use spacetimedb_testing::sdk::Test; | ||
|
||
const MODULE: &str = concat!("sdk-test", $suffix); | ||
const CLIENT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/test-client"); | ||
|
||
fn make_test(subcommand: &str) -> Test { | ||
Test::builder() | ||
.with_name(subcommand) | ||
.with_module(MODULE) | ||
.with_client(CLIENT) | ||
.with_language("rust") | ||
.with_bindings_dir("src/module_bindings") | ||
.with_compile_command("cargo build") | ||
.with_run_command(format!("cargo run -- {}", subcommand)) | ||
.build() | ||
} | ||
|
||
#[test] | ||
fn insert_primitive() { | ||
make_test("insert_primitive").run(); | ||
} | ||
|
||
#[test] | ||
fn delete_primitive() { | ||
make_test("delete_primitive").run(); | ||
} | ||
|
||
#[test] | ||
fn update_primitive() { | ||
make_test("update_primitive").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_identity() { | ||
make_test("insert_identity").run(); | ||
} | ||
|
||
#[test] | ||
fn delete_identity() { | ||
make_test("delete_identity").run(); | ||
} | ||
|
||
#[test] | ||
fn update_identity() { | ||
make_test("delete_identity").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_address() { | ||
make_test("insert_address").run(); | ||
} | ||
|
||
#[test] | ||
fn delete_address() { | ||
make_test("delete_address").run(); | ||
} | ||
|
||
#[test] | ||
fn update_address() { | ||
make_test("delete_address").run(); | ||
} | ||
|
||
#[test] | ||
fn on_reducer() { | ||
make_test("on_reducer").run(); | ||
} | ||
|
||
#[test] | ||
fn fail_reducer() { | ||
make_test("fail_reducer").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_vec() { | ||
make_test("insert_vec").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_simple_enum() { | ||
make_test("insert_simple_enum").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_enum_with_payload() { | ||
make_test("insert_enum_with_payload").run(); | ||
} | ||
|
||
#[test] | ||
fn insert_long_table() { | ||
make_test("insert_long_table").run(); | ||
} | ||
|
||
#[test] | ||
fn resubscribe() { | ||
make_test("resubscribe").run(); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn should_fail() { | ||
make_test("should_fail").run(); | ||
} | ||
|
||
#[test] | ||
fn reauth() { | ||
make_test("reauth_part_1").run(); | ||
make_test("reauth_part_2").run(); | ||
} | ||
|
||
#[test] | ||
fn reconnect_same_address() { | ||
make_test("reconnect_same_address").run(); | ||
} | ||
|
||
#[test] | ||
fn connect_disconnect_callbacks() { | ||
Test::builder() | ||
.with_name(concat!("connect_disconnect_callback_", stringify!($lang))) | ||
.with_module(concat!("sdk-test-connect-disconnect", $suffix)) | ||
.with_client(concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/tests/connect_disconnect_client" | ||
)) | ||
.with_language("rust") | ||
.with_bindings_dir("src/module_bindings") | ||
.with_compile_command("cargo build") | ||
.with_run_command("cargo run") | ||
.build() | ||
.run(); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
declare_tests_with_suffix!(rust, ""); | ||
declare_tests_with_suffix!(csharp, "-cs"); |
Oops, something went wrong.
79b2d04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmarking failed. Please check the workflow run for details.
79b2d04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Callgrind benchmark in progress...