Skip to content
Discussions/App Development/Best way to set up canton test fixtures?Forum ↗

Best way to set up canton test fixtures?

App Development3 posts323 views2 likesLast activity Mar 2022
DA
Daniel_PorterOP
Mar 2022

I’d like to run some tests that programmatically manipulate a canton instance. I heard a rumor the other day that we have a canton sandbox - I imagine this is what I actually want, but maybe not. What are the options/what sounds like a sensible approach?

RA
Ratko_Veprek
Mar 2022

The Daml Sandbox is now Canton based. The sandbox is just a specific configuration with 1 participant and 1 domain with in-memory storage. Otherwise, it’s a vanilla Canton system.

Generally, for integration testing of Canton, we use our “scalatest” based testing that allows us to run “integration tests” as unittests. These environments give you the equivalent of the Canton Console in your IDE and you can run a series of command as a “unittest”.

github.com

digital-asset/canton/blob/c6035298c302500f1c4bbe8f39145ea0dddb5168/community/app/src/test/scala/com/digitalasset/canton/integration/tests/ExampleIntegrationTest.scala#L77-L83

      
        
  1. class SimplePingExampleIntegrationTest
  2. extends ExampleIntegrationTest(simpleTopology / "simple-topology.conf") {
  3. "run simple-ping.canton successfully" in { implicit env =>
  4. runScript(simpleTopology / "simple-ping.canton")(env.environment)
  5. }
  6. }

The env object therein gives you a full console environment if you add import env._.

The test tooling is available in our open source drop as well, but the majority of the tests are still in the enterprise bundle.

DA
Daniel_Porter
Mar 2022

this looks perfect, thanks!

← Back to Discussions