test(lago): replace the docker-dependent case with a mock endpoint - #13716
Open
AlinsRan wants to merge 2 commits into
Open
test(lago): replace the docker-dependent case with a mock endpoint#13716AlinsRan wants to merge 2 commits into
AlinsRan wants to merge 2 commits into
Conversation
lago.t was skipped as a whole file since apache#12903, leaving the plugin with no test-nginx coverage: TEST 1 is plain check_schema validation and was only collateral damage of the file-level skip, while TEST 2 cloned getlago/lago over the network and brought up its docker compose stack, which is the actual flake. Restore the schema tests and replace the real-stack case with a deterministic one: a mock of Lago's batch endpoint in t/lib/server.lua records what the plugin sends, and the route drives one event through it. This runs on every PR with no network clone or docker, and asserts the plugin's real contract — the /api/v1/events/batch endpoint, the bearer token, the event fields, and that the ${var} templates are resolved. Fixes apache#12904
AlinsRan
force-pushed
the
test/restore-lago-schema-tests
branch
from
July 29, 2026 05:55
bd0a8f6 to
cf864c3
Compare
…ago-mock-endpoint # Conflicts: # t/lib/server.lua
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.
What this PR does
t/plugin/lago.thas been skipped as a whole file since #12903 (plan(skip_all)), leaving the lago plugin with no test-nginx coverage. The file has two cases:check_schemavalidation, no network, no docker. It was never the problem, just collateral damage of the file-level skip.pnpm test plugin/lago.spec.mts, which clonedgetlago/lagoover the network and brought up its docker compose stack. That is the actual flake (help request: Lago CI test failed to execute #12904).This restores the schema tests and replaces the real-stack case with a deterministic one: a mock of Lago's batch endpoint (
POST /api/v1/events/batch) int/lib/server.luarecords what the plugin sends, and the route drives one event through it.Fixes #12904
Why this over just skipping TEST 2
The real-stack test provides zero value while skipped, and its flake is inherent to cloning a third-party repo plus booting a multi-container stack wrapped in test-nginx
--- exec. A mock removes those dependencies entirely and runs on every PR, while covering the plugin's actual contract:/api/v1/events/batchendpoint is usedAuthorization: Bearer <token>is setcode/external_subscription_id/transaction_id${var}templates are resolved (${status}→200)Coverage note
What the mock does not cover is that the real Lago API accepts the payload — contract drift. That is better caught by an optional non-gating nightly job against the real stack than by a per-PR test that blocks unrelated merges, and it provided no such coverage while skipped anyway.