Skip to content

UNOMI-937: Stabilize integration tests and align CI with build.sh#764

Open
sergehuber wants to merge 8 commits into
masterfrom
UNOMI-937-itests-hardening-ci
Open

UNOMI-937: Stabilize integration tests and align CI with build.sh#764
sergehuber wants to merge 8 commits into
masterfrom
UNOMI-937-itests-hardening-ci

Conversation

@sergehuber
Copy link
Copy Markdown
Contributor

Summary

This PR reduces flaky integration tests in CI and makes GitHub Actions use the same build.sh workflow developers run locally. It should merge before UNOMI-921 / PR #759 (Docker Elasticsearch in ITs).

What changed

  • build.sh: Non-interactive mode for CI (--ci, CI / GITHUB_ACTIONS). Optional MAVEN_EXTRA_OPTS for matrix ports.
  • Integration tests: Replace fixed sleeps with polling in GraphQLListIT and PatchIT. Add waitForProfileProperty on BaseIT and use it in PropertiesUpdateActionIT.
  • GitHub Actions: Unit and IT jobs call ./build.sh instead of raw mvn.

What is out of scope

Test plan

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to support non-interactive CI runs (--ci, CI / GITHUB_ACTIONS) and to accept extra Maven opts via MAVEN_EXTRA_OPTS.
  • Switched GitHub Actions jobs to run ./build.sh --ci (and --integration-tests) instead of raw mvn commands.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants