clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.39k stars 110 forks source link

Test coverage - assert that equivalent Rust and C# modules produce the same DescribeModule output #1589

Open RReverser opened 2 months ago

RReverser commented 2 months ago

We want to test that C# and Rust modules, when written to expose the same set of tables, types and reducers, spacetime generate the same bindings. Actual codegen goes through the same path, and is checked by the SDK tests, so what's missing is a test that they return the same results from describe_module (or whatever it's called).

Conveniently, we already have interchangeable Rust and C# modules - the SDK test modules are known to be equivalent because we run the same client against both of them without rebuilding its bindings in between.

Write a test which, for each pair of Rust/C# SDK-test modules we happen to have sitting around, calls describe_module on each, deserializes/processes the result as necessary, and then asserts that they're the same.

kazimuth commented 2 months ago

Deserializing/processing the result can use the new ModuleDef type once that's merged. We'll need to be a little careful about comparing, since the typespaces can be reordered.

RReverser commented 2 months ago

Yeah I already have to normalise them while working on this, because raw Rust and C# outputs already differ.