feat: [E2E] Layers 4/5/6 — System, DSL, and Presets#193
feat: [E2E] Layers 4/5/6 — System, DSL, and Presets#193dhyaniarun1993 merged 33 commits intomainfrom
Conversation
- Add `e2e-deploy` named volume to bootstrap container so the manifest survives until tests read it - Write `/tmp/e2e-deploy.json` in docker-bootstrap.sh with contract addresses and issuer party IDs - Add E2E test architecture design doc
…file targets (#178) - Add tests/e2e/devstack/stack/interfaces.go: Anvil, Canton, APIServer, Relayer, Indexer, Postgres interfaces (build tag: e2e) - Add tests/e2e/devstack/stack/types.go: ServiceManifest, Account, AnvilAccount0/1, all request/response/row types, indexer page types - Add tests/e2e/docker-compose.e2e.yaml: thin include wrapper over root docker-compose.yaml; single entry point for E2E test runs - Extend Makefile with test-e2e, test-e2e-api, test-e2e-bridge, test-e2e-indexer targets (stub: "not yet implemented")
Implements issue #181: wires all shims into a composed System, adds high-level DSL operations (RegisterUser, Deposit, ERC20Balance, WaitFor*), and provides DoMain/NewFullStack entry points for test packages.
There was a problem hiding this comment.
Code Review
This pull request introduces a new E2E testing framework for the devstack, providing a DSL for high-level test operations and a system abstraction to manage service shims. The review feedback highlights a critical bug where balance amounts are compared lexicographically and suggests refactoring resource management by removing testing.T dependencies in global setup to prevent leaks. Additionally, it recommends implementing signal-aware context handling to ensure the Docker stack is properly torn down during interruptions.
Introduces NewIndexerStack and NewAPIStack preset constructors so that test packages only initialise the shims they actually use. DoMain now stores only the manifest; each New*Stack builds its own system with the correct t.Cleanup lifecycle.
- helpers.go: fix lexicographic string comparison in WaitForCantonBalance; parse amounts as big.Float and compare with Cmp - system.go: remove *testing.T from New/NewAPISystem; add closeFunc field and Close() method on System and APISystem for explicit resource management - presets.go: use signal.NotifyContext for SIGINT/SIGTERM handling in DoMain; Stop with fresh context to avoid cancellation race; register t.Cleanup for Close() in NewFullStack and NewAPIStack
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request establishes an E2E test framework for the devstack, providing a DSL for test operations, Docker-based service discovery, and specialized stack presets. The review identifies opportunities to reduce code duplication by centralizing the signEIP191 utility and refactoring shared shim initialization logic in the system package. Furthermore, the feedback suggests using the Anvil shim's Close method directly for better encapsulation.
salindne
left a comment
There was a problem hiding this comment.
I think theres something thats a bug, but I may be wrong, left a comment.
salindne
left a comment
There was a problem hiding this comment.
Couple small things, otherwise looks great
* feat: [E2E] bootstrap writes deploy manifest for test discovery (#177) - Add `e2e-deploy` named volume to bootstrap container so the manifest survives until tests read it - Write `/tmp/e2e-deploy.json` in docker-bootstrap.sh with contract addresses and issuer party IDs - Add E2E test architecture design doc * feat: [E2E] Layer 1 — stack interfaces, types, compose override, Makefile targets (#178) - Add tests/e2e/devstack/stack/interfaces.go: Anvil, Canton, APIServer, Relayer, Indexer, Postgres interfaces (build tag: e2e) - Add tests/e2e/devstack/stack/types.go: ServiceManifest, Account, AnvilAccount0/1, all request/response/row types, indexer page types - Add tests/e2e/docker-compose.e2e.yaml: thin include wrapper over root docker-compose.yaml; single entry point for E2E test runs - Extend Makefile with test-e2e, test-e2e-api, test-e2e-bridge, test-e2e-indexer targets (stub: "not yet implemented") * used existing types * used existing types * added per db dsn * feat: docker discovry added * feat: [E2E] Layer 2 — shim implementations * resolved gemni comments * removed unused db * feat: [E2E] Layers 4/5/6 — System, DSL, and Presets Implements issue #181: wires all shims into a composed System, adds high-level DSL operations (RegisterUser, Deposit, ERC20Balance, WaitFor*), and provides DoMain/NewFullStack entry points for test packages. * feat: [E2E] add IndexerSystem and APISystem subset views Introduces NewIndexerStack and NewAPIStack preset constructors so that test packages only initialise the shims they actually use. DoMain now stores only the manifest; each New*Stack builds its own system with the correct t.Cleanup lifecycle. * fix: address Gemini PR #193 review comments - helpers.go: fix lexicographic string comparison in WaitForCantonBalance; parse amounts as big.Float and compare with Cmp - system.go: remove *testing.T from New/NewAPISystem; add closeFunc field and Close() method on System and APISystem for explicit resource management - presets.go: use signal.NotifyContext for SIGINT/SIGTERM handling in DoMain; Stop with fresh context to avoid cancellation race; register t.Cleanup for Close() in NewFullStack and NewAPIStack * lint fixed * api server to act as ethclient * fix lint * optimized * optimized implementation * lint fixed * reolved gemini comments * e2e test for middleware server * resolved comments * feat: [E2E] Layer 2 — token client, error-safe NewCanton, HTTPError, util refactor * feat: [E2E] Layers 4/5/6 — Canton integration, token ops, WaitForAPIBalance, TestAccounts * added missing tests * addressed gemini comment * party generation on registration * resolve comment --------- Co-authored-by: Sebastian Lindner <33971232+salindne@users.noreply.github.com>
* feat: [E2E] bootstrap writes deploy manifest for test discovery (#177) - Add `e2e-deploy` named volume to bootstrap container so the manifest survives until tests read it - Write `/tmp/e2e-deploy.json` in docker-bootstrap.sh with contract addresses and issuer party IDs - Add E2E test architecture design doc * feat: [E2E] Layer 1 — stack interfaces, types, compose override, Makefile targets (#178) - Add tests/e2e/devstack/stack/interfaces.go: Anvil, Canton, APIServer, Relayer, Indexer, Postgres interfaces (build tag: e2e) - Add tests/e2e/devstack/stack/types.go: ServiceManifest, Account, AnvilAccount0/1, all request/response/row types, indexer page types - Add tests/e2e/docker-compose.e2e.yaml: thin include wrapper over root docker-compose.yaml; single entry point for E2E test runs - Extend Makefile with test-e2e, test-e2e-api, test-e2e-bridge, test-e2e-indexer targets (stub: "not yet implemented") * used existing types * used existing types * added per db dsn * feat: docker discovry added * feat: [E2E] Layer 2 — shim implementations * resolved gemni comments * removed unused db * feat: [E2E] Layers 4/5/6 — System, DSL, and Presets Implements issue #181: wires all shims into a composed System, adds high-level DSL operations (RegisterUser, Deposit, ERC20Balance, WaitFor*), and provides DoMain/NewFullStack entry points for test packages. * feat: [E2E] add IndexerSystem and APISystem subset views Introduces NewIndexerStack and NewAPIStack preset constructors so that test packages only initialise the shims they actually use. DoMain now stores only the manifest; each New*Stack builds its own system with the correct t.Cleanup lifecycle. * fix: address Gemini PR #193 review comments - helpers.go: fix lexicographic string comparison in WaitForCantonBalance; parse amounts as big.Float and compare with Cmp - system.go: remove *testing.T from New/NewAPISystem; add closeFunc field and Close() method on System and APISystem for explicit resource management - presets.go: use signal.NotifyContext for SIGINT/SIGTERM handling in DoMain; Stop with fresh context to avoid cancellation race; register t.Cleanup for Close() in NewFullStack and NewAPIStack * lint fixed * api server to act as ethclient * fix lint * optimized * optimized implementation * lint fixed * reolved gemini comments * e2e test for middleware server * resolved comments * feat: [E2E] Layer 2 — token client, error-safe NewCanton, HTTPError, util refactor * feat: [E2E] Layers 4/5/6 — Canton integration, token ops, WaitForAPIBalance, TestAccounts * added missing tests * addressed gemini comment * added test for relayer * optimized tests * resolved gemini comments * resolve comment * tk -> demoTk
Summary
system/system.go(Layer 4): composes all shims into a singleSystemstruct wired viaNew(ctx, t, manifest)dsl/dsl.go+dsl/helpers.go(Layer 5): high-level ops (RegisterUser,Deposit,ERC20Balance) and polling helpers (WaitForRelayerReady,WaitForCantonBalance,WaitForRelayerTransfer,WaitForIndexerEvent)presets/options.go+presets/presets.go(Layer 6):DoMain(m, opts...)forTestMainandNewFullStack(t)for per-test system accessTest plan
go build -tags e2e ./tests/e2e/...compiles cleanlyDoMainstarts compose stack, resolves manifest, initialises system, runsm.Run(), tears down on exitNewFullStackreturns the shared system; fails immediately ifDoMainwas not called firstCloses #181