Peaceful.Canton.Localnet.Testing
0.6.5.2
Prefix Reserved
See the version list below for details.
dotnet add package Peaceful.Canton.Localnet.Testing --version 0.6.5.2
NuGet\Install-Package Peaceful.Canton.Localnet.Testing -Version 0.6.5.2
<PackageReference Include="Peaceful.Canton.Localnet.Testing" Version="0.6.5.2" />
<PackageVersion Include="Peaceful.Canton.Localnet.Testing" Version="0.6.5.2" />
<PackageReference Include="Peaceful.Canton.Localnet.Testing" />
paket add Peaceful.Canton.Localnet.Testing --version 0.6.5.2
#r "nuget: Peaceful.Canton.Localnet.Testing, 0.6.5.2"
#:package Peaceful.Canton.Localnet.Testing@0.6.5.2
#addin nuget:?package=Peaceful.Canton.Localnet.Testing&version=0.6.5.2
#tool nuget:?package=Peaceful.Canton.Localnet.Testing&version=0.6.5.2
Peaceful.Canton.Localnet.Testing
xUnit fixtures for Canton LocalNet integration tests. Sub-modules:
EndpointDiscovery— env vars to URLs (JSON Ledger API, Keycloak token endpoint).OAuth2TokenProvider—client_credentialsgrant with in-memory cache + refresh.JsonLedgerAdminClient— thinHttpClientwrapper. Currently surfacesGET /v2/parties/participant-id.DarUploader—POST /v2/packagesfor one DAR or many; idempotent: aKNOWN_PACKAGE_VERSION400 response is treated as success.PartyAllocator—POST /v2/partieswith hint<consumer-prefix>-<instance-suffix>where the suffix is a 12-hex cryptographic random per fixture instance.UserBuilder—POST /v2/usersfollowed byPOST /v2/users/{id}/rightsto grantCanActAs/CanReadAs.LocalnetFixture— composes the above into a single user-facing surface viaMicrosoft.Extensions.DependencyInjectionand exposes convenience pass-throughs (UploadDarAsync,AllocatePartyAsync,CreateUserAsync,GetParticipantIdAsync).Validator(slot)returns a per-slot view exposing the same deep modules scoped to a single validator (handy for cross-validator scenarios);KnownSlots()returns the canonical slot set in stable order (sv-validator-1,a-validator-1,b-validator-1,c-validator-1,d-validator-1).
30-line example
await using var fixture = LocalnetFixture.FromEnvironment();
await fixture.UploadDarAsync("./dars/my-workflow-1.0.0.dar");
var party = await fixture.AllocatePartyAsync("globex");
await fixture.CreateUserAsync(
userId: $"globex-user-{fixture.PartyAllocator.InstanceSuffix}",
primaryParty: party.PartyId,
actAs: new[] { party.PartyId });
Environment variables
The fixture reads these env vars (matching the compose stack ports in compose/modules/localnet/env/common.env):
| Variable | Required | Default | Purpose |
|---|---|---|---|
CANTON_LOCALNET_PROFILE |
no | a-validator-1 |
One of sv-validator-1, a-validator-1, b-validator-1, c-validator-1, d-validator-1. |
CANTON_LOCALNET_JSON_API_URL |
no | http://localhost:{10,11,12,13,14}975 per profile |
Base URL of the JSON Ledger API. |
CANTON_LOCALNET_TOKEN_URL |
no for a/b/c/d, yes for sv | http://localhost:8082/realms/{AValidator1,BValidator1,CValidator1,DValidator1}/protocol/openid-connect/token per profile. The SvValidator1 profile has no default — no SV realm is imported into Keycloak today (compose/modules/keycloak/conf/data/ ships A/B/C/D only), so the SV slot's token URL (along with its client id and client secret) must be set explicitly, e.g. pointing at a custom realm you've added. |
Keycloak token endpoint. |
CANTON_LOCALNET_AUDIENCE |
no | https://canton.network.global |
Expected aud claim. |
CANTON_LOCALNET_CLIENT_ID |
yes | — | OAuth2 client_id. |
CANTON_LOCALNET_CLIENT_SECRET |
yes | — | OAuth2 client_secret. |
CANTON_LOCALNET_SCOPE |
no | openid |
OAuth2 scope. |
The integration test (LocalNetIntegrationTests) self-skips when CANTON_LOCALNET_JSON_API_URL / CLIENT_ID / CLIENT_SECRET are not set, so unit tests run cleanly on a developer machine without make up.
These env vars are the fixture / test config layer — distinct from
canton-localnet.yaml, which configures the CLI's stack-boot
(canton-localnet up). The fixture connects to an already-running
stack and needs per-slot URLs / credentials, so env vars are the
discovery mechanism here.
Run
dotnet test --filter "Category!=Integration" # unit tests only
dotnet test # all (smoke skipped unless env set)
dotnet pack src/Peaceful.Canton.Localnet.Testing -c Release
Layout
csharp/
Directory.Build.props # net10.0, nullable, treat warnings as errors
Directory.Packages.props # central package versions
NuGet.config # pins source to nuget.org with mapping
coverlet.runsettings # coverage config shared with csharp-ci.yaml
Peaceful.Canton.Localnet.Testing.sln
src/Peaceful.Canton.Localnet.Testing/
tests/Peaceful.Canton.Localnet.Testing.Tests/
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.0.1 | 189 | 8/13/2026 |
| 0.7.0.1-preview.1 | 53 | 8/6/2026 |
| 0.6.14.1-preview.1 | 56 | 8/5/2026 |
| 0.6.13.1-preview.1 | 59 | 7/22/2026 |
| 0.6.11.1-preview.1 | 265 | 7/14/2026 |
| 0.6.10.1-preview.1 | 191 | 7/4/2026 |
| 0.6.9.1-preview.1 | 110 | 6/24/2026 |
| 0.6.5.3-preview.1 | 194 | 6/14/2026 |
| 0.6.5.2 | 246 | 6/10/2026 |