UNOMI-937: Stabilize integration tests and align CI with build.sh#764
Open
sergehuber wants to merge 8 commits into
Open
UNOMI-937: Stabilize integration tests and align CI with build.sh#764sergehuber wants to merge 8 commits into
sergehuber wants to merge 8 commits into
Conversation
Non-interactive prompts when CI, GITHUB_ACTIONS, or BUILD_NON_INTERACTIVE is set. Add --ci (no Karaf, no Maven build cache) and MAVEN_EXTRA_OPTS for matrix ports.
Replace fixed sleeps in GraphQLListIT and poll after patch refresh in PatchIT.
Poll profile properties after events in PropertiesUpdateActionIT.
Align CI with local developer workflow; pass matrix ports via MAVEN_EXTRA_OPTS.
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce integration-test flakiness by replacing fixed sleeps with polling-based waits, and to align GitHub Actions with the same build.sh workflow developers run locally (including a non-interactive CI mode).
Changes:
- Added reusable polling helper(s) for eventual-consistency in ITs (e.g.,
waitForProfileProperty) and applied polling in several flaky tests. - Updated
build.shto support non-interactive CI runs (--ci,CI/GITHUB_ACTIONS) and to accept extra Maven opts viaMAVEN_EXTRA_OPTS. - Switched GitHub Actions jobs to run
./build.sh --ci(and--integration-tests) instead of rawmvncommands.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java |
Replaces immediate assertions with polling for profile property updates after sending events. |
itests/src/test/java/org/apache/unomi/itests/PatchIT.java |
Replaces immediate reads with polling for patched definitions/property types. |
itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java |
Replaces fixed sleep with polling until GraphQL query reflects expected state. |
itests/src/test/java/org/apache/unomi/itests/BaseIT.java |
Adds waitForProfileProperty helper used by tests. |
build.sh |
Adds CI/non-interactive behavior and supports MAVEN_EXTRA_OPTS. |
.github/workflows/unomi-ci-build-tests.yml |
Uses ./build.sh --ci for unit + integration test jobs and wires matrix ports via env. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| final ResponseContext findListsContext = keepTrying("Failed waiting for profile in list query", | ||
| () -> { | ||
| try (CloseableHttpResponse response = post("graphql/list/find-lists.json")) { | ||
| return ResponseContext.parse(response.getEntity()); |
Comment on lines
40
to
56
| @Test | ||
| public void testPatch() throws IOException { | ||
| PropertyType company = profileService.getPropertyType("company"); | ||
|
|
||
| try { | ||
| Patch patch = CustomObjectMapper.getObjectMapper().readValue(bundleContext.getBundle().getResource("patch1.json"), Patch.class); | ||
| PropertyType newCompany = (PropertyType) patchService.patch(patch); | ||
|
|
||
| Assert.assertEquals("foo", newCompany.getDefaultValue()); | ||
|
|
||
| profileService.refresh(); | ||
|
|
||
| newCompany = profileService.getPropertyType("company"); | ||
| newCompany = keepTrying("Failed waiting for patched property type", | ||
| () -> profileService.getPropertyType("company"), | ||
| pt -> pt != null && "foo".equals(pt.getDefaultValue()), | ||
| DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES); | ||
| Assert.assertEquals("foo", newCompany.getDefaultValue()); |
Comment on lines
62
to
78
| @Test | ||
| public void testOverride() throws IOException { | ||
| PropertyType gender = profileService.getPropertyType("gender"); | ||
|
|
||
| try { | ||
| Patch patch = CustomObjectMapper.getObjectMapper().readValue(bundleContext.getBundle().getResource("patch2.json"), Patch.class); | ||
| PropertyType newGender = (PropertyType) patchService.patch(patch); | ||
|
|
||
| Assert.assertEquals("foo", newGender.getDefaultValue()); | ||
|
|
||
| profileService.refresh(); | ||
|
|
||
| newGender = profileService.getPropertyType("gender"); | ||
| newGender = keepTrying("Failed waiting for patched property type", | ||
| () -> profileService.getPropertyType("gender"), | ||
| pt -> pt != null && "foo".equals(pt.getDefaultValue()), | ||
| DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES); | ||
| Assert.assertEquals("foo", newGender.getDefaultValue()); |
Use Maven help:evaluate with -q -DforceStdout so UNOMI_VERSION is only the version string, not thousands of dependency download lines. Simplify ERR trap so handle_error does not pass huge $BASH_COMMAND on failure.
Add -B -ntp to Maven invocations when running non-interactively (CI, GITHUB_ACTIONS, or --ci) so logs stay readable like the former mvn -ntp workflow.
…ying Fix testCompile failures for testPatch and testOverride.
GraphQLListIT: catch checked exceptions inside keepTrying supplier. PropertiesUpdateActionIT: restore in-memory assert for CurrentProfile; keep persistence polling only for NotCurrentProfile.
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.
Summary
This PR reduces flaky integration tests in CI and makes GitHub Actions use the same
build.shworkflow developers run locally. It should merge before UNOMI-921 / PR #759 (Docker Elasticsearch in ITs).What changed
--ci,CI/GITHUB_ACTIONS). OptionalMAVEN_EXTRA_OPTSfor matrix ports.GraphQLListITandPatchIT. AddwaitForProfilePropertyonBaseITand use it inPropertiesUpdateActionIT../build.shinstead of rawmvn.What is out of scope
Test plan
./build.sh --ci./build.sh --ci --integration-testsUNOMI-921-itests-es-dockeron this branch and retarget PR UNOMI-921: Replace elasticsearch-maven-plugin with Docker-based Elasticsearch in integration tests #759