SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

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

Open RReverser opened this issue 1 year ago • 2 comments

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.

RReverser avatar Aug 14 '24 14:08 RReverser

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.

kazimuth avatar Aug 14 '24 20:08 kazimuth

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

RReverser avatar Aug 14 '24 22:08 RReverser