Skip to content

UNOMI-139 UNOMI-878: Platform integration tests#766

Merged
sergehuber merged 5 commits into
masterfrom
UNOMI-139-878-integration-tests
Jun 10, 2026
Merged

UNOMI-139 UNOMI-878: Platform integration tests#766
sergehuber merged 5 commits into
masterfrom
UNOMI-139-878-integration-tests

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Summary

  • Adds TenantIT, SecurityIT, PersonaIT, SchedulerIT, and EventsCollectorIT integration test classes covering multitenancy and core platform flows
  • Fixes TenantIT and EventsCollectorIT test failures (reverted intermediate fix, replaced with stable version)
  • Moves HealthCheckIT to run last in AllITs suite to avoid startup-timing flakiness

Test plan

  • All five new IT classes pass in a full ./build.sh --ci --integration-tests run
  • AllITs suite ordering change does not affect other tests
  • Stacked on PR for UNOMI-880-878-shell-dev-commands — merge that first

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds new PaxExam-based integration tests to cover multitenancy, security/system execution context behavior, scheduler REST API flows, persona sessions, and event collector authentication; also updates the AllITs suite ordering to include the new tests and run HealthCheckIT last to reduce flakiness.

Changes:

  • Added new integration test classes: TenantIT, SecurityIT, SchedulerIT, PersonaIT, EventsCollectorIT.
  • Added persona test payload resource for creating a persona with sessions via REST.
  • Updated AllITs to include the new ITs and move HealthCheckIT to the end.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
itests/src/test/resources/persona/persona-with-sessions-payload.json Adds payload used by persona/session integration test.
itests/src/test/java/org/apache/unomi/itests/TenantIT.java Adds multitenancy and API key/auth integration coverage.
itests/src/test/java/org/apache/unomi/itests/SecurityIT.java Adds system subject/context execution and restoration coverage.
itests/src/test/java/org/apache/unomi/itests/SchedulerIT.java Adds scheduler task REST API integration coverage.
itests/src/test/java/org/apache/unomi/itests/PersonaIT.java Adds persona-with-sessions creation and retrieval coverage.
itests/src/test/java/org/apache/unomi/itests/EventsCollectorIT.java Adds event collector authentication/flags coverage.
itests/src/test/java/org/apache/unomi/itests/AllITs.java Registers new ITs and moves HealthCheckIT to run last.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread itests/src/test/java/org/apache/unomi/itests/SchedulerIT.java
Comment thread itests/src/test/java/org/apache/unomi/itests/SchedulerIT.java Outdated
Comment thread itests/src/test/java/org/apache/unomi/itests/TenantIT.java
Comment on lines +388 to +394
Tenant tenant = tenantService.createTenant("expired-tenant", Collections.emptyMap());
ApiKey apiKey = tenantService.generateApiKey(tenant.getItemId(), 1L); // 1ms validity

Thread.sleep(2); // Wait for key to expire

Assert.assertFalse(tenantService.validateApiKey(tenant.getItemId(), apiKey.getItemId()));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. The call was corrected to apiKey.getKey(), which passes the actual secret value as expected by validateApiKey(). The test now also cleans up the tenant in a finally block.

Comment thread itests/src/test/java/org/apache/unomi/itests/EventsCollectorIT.java
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 7cb94e6 to 8fef941 Compare June 2, 2026 17:49
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from c06d88c to 81efb61 Compare June 2, 2026 17:50
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 8fef941 to 70b8c49 Compare June 2, 2026 18:47
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from 81efb61 to 6bdc8c9 Compare June 2, 2026 18:48
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 70b8c49 to 7897291 Compare June 2, 2026 19:44
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from 6bdc8c9 to 95c656c Compare June 2, 2026 19:44
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 7897291 to 03481dd Compare June 6, 2026 06:22
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from 95c656c to bc248ea Compare June 6, 2026 06:25
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 03481dd to d9512ab Compare June 7, 2026 19:39
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from bc248ea to 4f98f34 Compare June 7, 2026 19:40
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from d9512ab to b5003e0 Compare June 8, 2026 10:04
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from 4f98f34 to de19c58 Compare June 8, 2026 10:04
@sergehuber sergehuber changed the base branch from UNOMI-880-878-shell-dev-commands to master June 9, 2026 16:35
Add TenantIT, SecurityIT, PersonaIT, EventsCollectorIT, SchedulerIT and
persona test fixture. Register platform ITs in AllITs (including
TenantIT, SchedulerIT, EventsCollectorIT for CI coverage per split plan).
- TenantIT: use /cxs/context.json (REST endpoint) instead of legacy
  /context.json servlet forward that timed out under Pax Exam.
- EventCollectorResponse: add Jackson @JsonCreator so IT clients can
  deserialize the POST /cxs/eventcollector JSON body.
Avoid heavy concurrent /health/check load immediately before TenantIT.
@sergehuber sergehuber force-pushed the UNOMI-139-878-integration-tests branch from de19c58 to 96e9396 Compare June 9, 2026 16:38
Fix several bugs found during review:

- TenantIT: two JAAS auth tests were reusing request objects that still
  had the previous auth header set, so they were not actually testing
  JAAS — now each JAAS assertion uses a fresh request
- TenantIT: apiKey.getItemId() was passed instead of apiKey.getKey()
  to validateApiKey(), making the expiry test always return false
- SchedulerIT: testRetryTask was waiting for the task executor to run
  and fail organically, but the test node may not be the scheduler
  executor node — now uses saveTask() to put the task in FAILED state
  directly before calling the retry endpoint

Improve test reliability:

- All tests that create tenants now clean up in a finally block, so a
  test failure does not leave state behind for the next test
- HTTP responses are now closed with try-with-resources in all tests
- Thread.sleep(1500) replaced with keepTrying() polling

Clean up dead code:

- Remove unused constants and imports from EventsCollectorIT,
  SecurityIT, and SchedulerIT
- PersonaIT setUp() was returning a closed HTTP response through the
  keepTrying chain — now returns Boolean.TRUE instead

Add no-arg constructor to EventCollectorResponse for Jackson
deserialization compatibility
@sergehuber sergehuber merged commit 0aa36bc into master Jun 10, 2026
6 checks passed
@sergehuber sergehuber deleted the UNOMI-139-878-integration-tests branch June 10, 2026 08:50
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