Run integration tests in CI and fix the openig-war IT suite#165
Open
vharseko wants to merge 3 commits into
Open
Run integration tests in CI and fix the openig-war IT suite#165vharseko wants to merge 3 commits into
vharseko wants to merge 3 commits into
Conversation
Switch the CI build from `mvn package` to `mvn verify` so the failsafe integration tests actually execute. `package` stops before the integration-test/verify phases, so IT_MockRoute/IT_SwaggerRoute (openig-war) and the openig-doc Sample tests never ran in CI. Make openig-war enforce IT results: its failsafe execution only bound `integration-test`, so failures were silently swallowed - add the `verify` goal. Mirror surefire's `--add-opens` argLine onto the failsafe plugin so RestAssured assertion failures report cleanly on JDK 17+ instead of a GroovyRuntimeException. Fix the war IT fixtures: the shared petstore spec declares base path `/v2.1` but the mock/custom routes used `/v2`, so the mock handler never matched an operation (404). Align the request paths and route conditions to `/v2.1`, using an unescaped dot in the route JSON conditions (an escaped `\.` fails to compile in the EL string literal and the route is silently rejected).
IT_MockRoute and IT_SwaggerRoute substitute an absolute spec-file path into
the route JSON and an EL `read('...')` expression. On Windows the path uses
backslashes (C:\..., D:\...), which are invalid JSON/EL escapes, so the route
JSON fails to parse and the route never loads (routeAvailable times out).
Normalise the injected paths to forward slashes, which OpenIG's read()/File
accepts on every OS (no-op on Linux/macOS).
70b0b4e to
dde1fdc
Compare
The auto-built OpenAPI route embeds specFile.getAbsolutePath() into an EL
`${read('...')}` string literal for the validator and mock-handler config.
On Windows the absolute path uses the '\' separator, which the EL parser
treats as an (invalid) escape sequence, so the generated route fails to parse
and never loads. Normalise the platform separator to '/', which read()/File
accept on every OS (no-op on Linux/macOS).
dde1fdc to
63791d6
Compare
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.
Problem
CI (
build.yml) ranmvn package, whose lifecycle stops before theintegration-test/verifyphases. As a result the failsafe integration tests never executed in CI:openig-war:IT_MockRoute,IT_SwaggerRoute(added in Add OpenApiMockResponseHandler — spec-driven mock API with realistic test data #155) — never ranopenig-doc:SampleApplicationTest,SampleFilterTestWhen actually executed, the
openig-warIT suite was red (3 of 4 failing), andopenig-warwasn't even configured to fail the build on IT failures.Changes
build.yml:mvn package→mvn verifyso failsafe runs on every push/PR.openig-war/pom.xml: add<goal>verify</goal>to the failsafe execution — previously onlyintegration-testwas bound, so IT failures were silently swallowed.pom.xml: mirror surefire's--add-opensargLine onto the failsafe plugin. Without it, on JDK 17+ RestAssured/Groovy cannot constructAssertionErrorand a genuine assertion failure surfaces as a confusingGroovyRuntimeException.IT_MockRoute.java,petstore-mock.json,01-find-pet.json): the shared petstore spec declares base path/v2.1, but the mock/custom routes used/v2, so the mock handler never matched an operation → 404. Aligned request paths and route conditions to/v2.1(unescaped dot in the JSON conditions — an escaped\.fails to compile in the EL string literal and the route is silently rejected).No product code changed — only the CI goal, build config, and test fixtures.
Verification
Full
mvn verify(the new CI command) — BUILD SUCCESS, all 16 modules green:openig-warfailsafe: 4 tests, 0 failures (failsafe:verifynow enforces)openig-docfailsafe: 10 tests, 0 failuresEnforcement confirmed both ways: with the fixtures still broken the build failed at
failsafe:verify @ openig-war; after the fix it passes.Note (out of scope)
Six
@Test(enabled=false)methods inopenig-core(RequestResolverTest,GroovyScriptableFilterTest,JsonValuesTest) remain disabled — enabling them requires implementing the corresponding functionality, not just flipping the flag.