Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the non deterministic test testSerdeWithSpecAndInputFormat #17500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yugvajani
Copy link

Fixed a non deterministic test in org.apache.druid.indexing.kafka.supervisor.KafkaSupervisorSpecTest.testSerdeWithSpecAndInputFormat

Steps to reproduce

To reproduce the problem, first build the module kafka-indexing-service:

mvn install -pl extensions-core/kafka-indexing-service -am -DskipTests

Then, run the regular test:

mvn -pl extensions-core/kafka-indexing-service test -Dtest=org.apache.druid.indexing.kafka.supervisor.KafkaSupervisorSpecTest#testSerdeWithSpecAndInputFormat

To identify the flaky test, execute the following nondex command:

mvn -pl extensions-core/kafka-indexing-service edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.apache.druid.indexing.kafka.supervisor.KafkaSupervisorSpecTest#testSerdeWithSpecAndInputFormat

Description

The testSerdeWithSpecAndInputFormat was producing non-deterministic output because the JSON object used in the test did not include a parser that enforced a specific order, unlike other tests. Due to the inherent non-deterministic nature of JSON serialization, this resulted in inconsistent outputs. The dimension spec array gave non deterministic order on different runs as follow-
expected: "dimensionExclusions":["timestamp","value_min","count","value_sum","__time","value","value_max"]
actual: "dimensionExclusions":["value_min","count","value_sum","value","value_max","timestamp","__time""] .

The fix involves adding a parser to the JSON like the other tests to ensure a consistent order.



This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant