Skip to content
Merged
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spacetimedb-testing = { path = "../testing" }

ahash.workspace = true
anyhow.workspace = true
convert_case.workspace = true
anymap.workspace = true
byte-unit.workspace = true
clap.workspace = true
Expand Down
22 changes: 11 additions & 11 deletions crates/bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod tests {
sqlite::SQLite,
ResultBench,
};
use serial_test::serial;
use spacetimedb_testing::modules::{Csharp, Rust};
use std::{io, path::Path, sync::Once};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
Expand Down Expand Up @@ -102,7 +103,6 @@ mod tests {
Ok(())
}

#[allow(dead_code)]
fn test_basic_invariants<DB: BenchDatabase>() -> ResultBench<()> {
basic_invariants::<DB, u32_u64_str>(IndexStrategy::Unique0, true)?;
basic_invariants::<DB, u32_u64_u64>(IndexStrategy::Unique0, true)?;
Expand All @@ -111,29 +111,29 @@ mod tests {
Ok(())
}

// #[test]
fn _test_basic_invariants_sqlite() -> ResultBench<()> {
#[test]
fn test_basic_invariants_sqlite() -> ResultBench<()> {
test_basic_invariants::<SQLite>()
}

// #[test]
fn _test_basic_invariants_spacetime_raw() -> ResultBench<()> {
#[test]
fn test_basic_invariants_spacetime_raw() -> ResultBench<()> {
test_basic_invariants::<SpacetimeRaw>()
}

// note: there can only be one #[test] invoking spacetime module stuff.
// #[test]s run concurrently and they fight over lockfiles.
// so, run the sub-tests here in sequence.

// #[test]
// #[serial]
fn _test_basic_invariants_spacetime_module_rust() -> ResultBench<()> {
#[test]
#[serial]
fn test_basic_invariants_spacetime_module_rust() -> ResultBench<()> {
test_basic_invariants::<SpacetimeModule<Rust>>()
}

// #[test]
// #[serial]
fn _test_basic_invariants_spacetime_module_csharp() -> ResultBench<()> {
#[test]
#[serial]
fn test_basic_invariants_spacetime_module_csharp() -> ResultBench<()> {
test_basic_invariants::<SpacetimeModule<Csharp>>()
}
}
10 changes: 8 additions & 2 deletions crates/bench/src/spacetime_module.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{marker::PhantomData, path::Path};

use convert_case::{Case, Casing};
use spacetimedb::db::{Config, Storage};
use spacetimedb_lib::{
sats::{product, ArrayValue},
Expand Down Expand Up @@ -89,9 +90,14 @@ impl<L: ModuleLanguage> BenchDatabase for SpacetimeModule<L> {
table_style: crate::schemas::IndexStrategy,
) -> ResultBench<Self::TableId> {
// Noop. All tables are built into the "benchmarks" module.
// The module's default CaseConversionPolicy is SnakeCase, which
// inserts underscores at letter-digit boundaries (e.g. u32 -> u_32).
// We must match that here so reducer/table lookups succeed.
let raw = table_name::<T>(table_style);
let converted = raw.as_ref().to_case(Case::Snake);
Ok(TableId {
pascal_case: table_name::<T>(table_style),
snake_case: table_name::<T>(table_style),
pascal_case: TableName::for_test(&converted),
snake_case: TableName::for_test(&converted),
})
}

Expand Down
Loading