Skip to content

UNOMI-933/934/935: Add REST input validation integration tests#794

Merged
sergehuber merged 3 commits into
masterfrom
UNOMI-933-934-935-input-validation-it
Jul 1, 2026
Merged

UNOMI-933/934/935: Add REST input validation integration tests#794
sergehuber merged 3 commits into
masterfrom
UNOMI-933-934-935-input-validation-it

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Plain-language summary

Bad JSON sent to Unomi can crash a request with a server error instead of a clear “bad request” response. This change adds automated integration tests that send invalid payloads to the context API and to rule/segment create endpoints, and check that Unomi returns HTTP 400.

These tests lock in the fixes from earlier REST error-handling work so the same bugs do not come back in a release.

What changed

  • Added JSON fixtures for invalid context requests (garbage body, empty event source/target), rules, and segments.
  • Extended InputValidationIT with UNOMI-933 cases for /context.json.
  • Added RestCreateValidationIT for POST /cxs/rules and /cxs/segments returning 400 with {"errorMessage":"badRequest"}.
  • Registered the new test class in AllITs.

Test plan

  • mvn test-compile in itests/ (local)
  • Full PaxExam IT suite in CI

References

UNOMI-933, UNOMI-934, UNOMI-935

Extend context.json validation tests and add REST create tests so bad payloads return 400 instead of 500.
Accept plain-text InvalidRequestException bodies or JSON badRequest from Jackson mappers on /context.json.
- RestCreateValidationIT: add @after teardown, happy-path 204 tests,
  retry-aware HTTP client, null-safe body assertion, scoped LogChecker
- InputValidationIT: extend garbageBody to cover /context.js, add GET
  variants for eventEmptySource/Target, null-safe assertInvalidClientDataResponse
- Add rule_valid.json and segment_valid.json fixtures
@sergehuber sergehuber merged commit b1b73db into master Jul 1, 2026
6 checks passed
@sergehuber sergehuber deleted the UNOMI-933-934-935-input-validation-it branch July 1, 2026 11:21
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.

1 participant