feat(test): add --dry-run for zero-infrastructure local contract testing#458
Open
Caesarsage wants to merge 2 commits into
Open
feat(test): add --dry-run for zero-infrastructure local contract testing#458Caesarsage wants to merge 2 commits into
Caesarsage wants to merge 2 commits into
Conversation
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Contributor
Author
|
The License Compliance failure is MPL-2.0 from adding testcontainers-go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description
Adds
microcks test --dry-run: run a contract test with no pre-existing infrastructure — no running Microcks server, no Keycloak credentials, no upfrontimport. The CLI spins up an ephemeral Microcks container viamicrocks.io/testcontainers-go, imports the artifact, runs the test against your endpoint, prints the result, and tears the container down (or keep running and view on the UI when you pass the --watch flag).New flags (all scoped to
--dry-run)--dry-runfalse--artifact--image…/microcks-uber:latest-native*-native)--ready-timeout90s--watchfalseHow it works
signal.NotifyContext(SIGINT, SIGTERM)with a deferredTerminate, so the container is removed on every exit path including Ctrl+C.localhost/127.0.0.1test endpoint is auto-exposed to the container and rewritten to the host gateway (host.testcontainers.internal), so the documented example works as-is.runTestAndWait,cmd/testExecutor.go) — the dry-run path produces the sameTestResultflow as the normal path, it doesn't fork it.--watchkeeps one container alive across saves; an invalid spec mid-edit logs and keeps watching rather than killing the loop.Validation
--artifactand--watcherror clearly if used without--dry-run.*-native--imagefails fast (the auth-disabled native image is required for the zero-config path).Refactors (per RFC §7)
cmd/test.gointo a sharedrunTestAndWait(cmd/testExecutor.go) used by both paths.Tests
cmd/testDryRun_test.go).success: true, exit 0; non-conforming target → exit 1; container removed within seconds of exit; wrong image flavor fails fast;--watchre-runs on save with a live details link and tears down cleanly on Ctrl+C.Follow-ups (separate PRs in this stack)
Design doc: https://docs.google.com/document/d/1_V15WjMPyKYZQHpoYDFm71iRh-pwdhZeo0g9vj0ugs0/edit?usp=sharing
Refs #255