Skip to content

Fix test assertions that depend on undefined row ordering#3007

Open
clayly wants to merge 2 commits intoeclipse-hawkbit:masterfrom
clayly:fix/test-ordering-assertions
Open

Fix test assertions that depend on undefined row ordering#3007
clayly wants to merge 2 commits intoeclipse-hawkbit:masterfrom
clayly:fix/test-ordering-assertions

Conversation

@clayly
Copy link
Copy Markdown

@clayly clayly commented Apr 9, 2026

Summary

Several integration tests use order-sensitive assertions (containsExactly, index-based access) on query results from queries with no ORDER BY clause. SQL does not guarantee row ordering without explicit ORDER BY, and this causes deterministic test failures on databases that don't return rows in insertion order (e.g. YugabyteDB, CockroachDB, or any distributed PostgreSQL-compatible DB).

The tests verify set membership (correct targets assigned, correct actions stored), not ordering. Changed to order-independent assertions:

  • AutoAssignTest (3 tests): containsExactlycontainsExactlyInAnyOrder on findByAssignedDistributionSet() results
  • ControllerManagementTest.updatedExternalRefOnActionIsReallyUpdated: index-based loop → containsExactlyInAnyOrderElementsOf
  • TargetFilterQueryManagementTest: containsExactlycontainsExactlyInAnyOrder in verifyExpectedFilterQueriesInList helpers

Test plan

  • Verified passing on H2 (default)
  • Verified passing on YugabyteDB (PostgreSQL 15.12-YB-2025.2.2.2-b0)
  • Verify passing on PostgreSQL
  • Verify passing on MySQL

Several tests use containsExactly() or index-based comparison on query
results that have no ORDER BY clause. SQL does not guarantee row ordering
without explicit ORDER BY, and databases like YugabyteDB return results
in a different (but valid) order than PostgreSQL/H2.

These tests verify set membership (correct targets assigned, correct
actions stored), not ordering. Changed to order-independent assertions:

- AutoAssignTest: containsExactly -> containsExactlyInAnyOrder
- ControllerManagementTest: index-based loop -> containsExactlyInAnyOrderElementsOf
- TargetFilterQueryManagementTest: containsExactly -> containsExactlyInAnyOrder

Verified passing on H2 (default) and YugabyteDB (PostgreSQL-compatible).
@hawkbit-bot
Copy link
Copy Markdown

Thanks @clayly for taking the time to contribute to hawkBit! We really appreciate this. Make yourself comfortable while I'm looking for a committer to help you with your contribution.
Please make sure you read the contribution guide and signed the Eclipse Contributor Agreement (ECA).

@clayly
Copy link
Copy Markdown
Author

clayly commented Apr 9, 2026

Hi everyone! Main purpose of such PR is to make it more easy to adapt hawkbit for other Postgres-compatible DB's. Also looks like eclipsedfn/eca check succeeds now for me, do i need to recreate PR?

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