Skip to content

Adds Coordination Diagnostics Tests#142709

Merged
joshua-adams-1 merged 10 commits intoelastic:mainfrom
joshua-adams-1:coordination-diagnostics
Mar 10, 2026
Merged

Adds Coordination Diagnostics Tests#142709
joshua-adams-1 merged 10 commits intoelastic:mainfrom
joshua-adams-1:coordination-diagnostics

Conversation

@joshua-adams-1
Copy link
Copy Markdown
Contributor

Replaces the limited serialisation tests inside CoordinationDiagnosticsServiceTests with CoordinationDiagnosticsDetailsWireSerializingTests, CoordinationDiagnosticsResultWireSerializingTests and CoordinationDiagnosticsStatusWireSerializingTests, as well as adding extra unit tests to CoordinationDiagnosticsServiceTests

Adds CoordinationDiagnosticsDetailsWireSerializingTests,
CoordinationDiagnosticsResultWireSerializingTests and CoordinationDiagnosticsStatusWireSerializingTests
@joshua-adams-1 joshua-adams-1 self-assigned this Feb 19, 2026
@joshua-adams-1 joshua-adams-1 added >test Issues or PRs that are addressing/adding tests :Distributed/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. labels Feb 19, 2026
@joshua-adams-1
Copy link
Copy Markdown
Contributor Author

As a note, these tests were added via LLM during spacetime, and since the tests heavily rely on randomisation, the newly added tests have been run a couple of thousand times to ensure there are no failure paths

@joshua-adams-1 joshua-adams-1 marked this pull request as ready for review February 25, 2026 12:05
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Feb 25, 2026
@DiannaHohensee
Copy link
Copy Markdown
Contributor

DiannaHohensee commented Feb 25, 2026

What's the motivation for the additional/changed testing?

@joshua-adams-1
Copy link
Copy Markdown
Contributor Author

What's the motivation for the additional/changed testing?

As part of my SpaceTime project, I was using LLMs to identify testing gaps in the codebase. For want of needing a package to apply this to, I picked cluster/coordination since I've worked in there a lot. It identified that while we have some limited serialisation tests, there are no dedicated test suites for the CoordinationDiagnosticsService. I agree that additional testing is always beneficial, and so I got it to make the test files in this PR. For context, I've made other PRs adding tests. Some links include #142755 where I've again extended the serialisation test coverage, and then #142703 where I've added serialisation tests specifically. While serialisation is covered during integration testing, the AbstractWireSerializingTestCase specifically checks for:

  • Ensures objects correctly serialize and deserialize over the transport layer
  • Catches wire‑compatibility and version‑gating issues early
  • Validates equals / hashCode consistency for serialized objects
  • Reduces boilerplate by using a standard, reusable test base
  • Prevents subtle regressions when fields or serialization logic change

which is always good to have!

Copy link
Copy Markdown
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

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

Looks fine, made some suggestions. It seems like mutateInstance doesn't need to be implemented for records, so optionally that code could be tossed?

}

@Override
protected CoordinationDiagnosticsDetails mutateInstance(CoordinationDiagnosticsDetails instance) throws IOException {
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.

This patch is refactoring the pre-existing test, so this isn't new, but there is a comment (looks like you added a bit ago) that suggests there's no purpose in implementing mutateInstance for records with default equals() implementations.

I wonder if this logic should be removed, but I don't have much of an opinion. I didn't do code sleuthing, but it's possible that these objects were originally classes and later became records -- we've been slowly converting code to records where possible for a while, AIUI.

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.

Good catch! I was writing tests via an LLM and despite specifically requesting it didn't implement mutateInstance for records it went and did it anyways! Anyways, I think my job is safe for a while 😆

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.

Ha, yeah, it did that to me recently, too. "AI" is a probabilistic stats model, i.e. technically random behavior 😅

Copy link
Copy Markdown
Contributor Author

@joshua-adams-1 joshua-adams-1 left a comment

Choose a reason for hiding this comment

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

Thanks for reviewing! Have addressed all your comments

}

@Override
protected CoordinationDiagnosticsDetails mutateInstance(CoordinationDiagnosticsDetails instance) throws IOException {
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.

Good catch! I was writing tests via an LLM and despite specifically requesting it didn't implement mutateInstance for records it went and did it anyways! Anyways, I think my job is safe for a while 😆

@joshua-adams-1 joshua-adams-1 merged commit 9e70c6c into elastic:main Mar 10, 2026
30 checks passed
@joshua-adams-1 joshua-adams-1 deleted the coordination-diagnostics branch March 10, 2026 11:17
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 10, 2026
…locations

* upstream/main: (126 commits)
  Update KnnIndexTester to use more settings from datasets (elastic#143869)
  fix: dynamic template vector array is overridden by automatic dense_vector mapping (elastic#143733)
  ES|QL: Don't reuse the same alias for _fork column (elastic#143909)
  Close and initialize clients after each node upgrade in logsdb rolling upgrade tests. (elastic#143823)
  ESQL: Added GroupedTopNOperator for LIMIT BY, compute only (elastic#143476)
  Handle views in ResolveIndexAction (elastic#143561)
  Improve reindex rethrottle API in stateless (elastic#143771)
  Use a copy of the SearchExecutionContext for each Percolator execution (elastic#142765)
  Log the stacktrace when we encounter a deprecation warning for `default_metric` (elastic#143929)
  ESQL: evaluate ReferenceAttributes to potentially FieldAttributes for full-text functions restriction (elastic#143893)
  Add ClusterStateSerializationStats Serializatation Tests (elastic#142703)
  Adds Coordination Diagnostics Tests (elastic#142709)
  Upgrade Elasticsearch to Apache Lucene 10.4 (elastic#141882)
  ESQL: Add configurable bracket-based multi-value support for CSV reader (elastic#143890)
  time series es819 binary dv use up to a 1mb block size (elastic#143049)
  Dynamically enable / disable plugins in correspondence to stateless mode. (elastic#142147)
  ES|QL: Implement first/last_over_time for tdigest (elastic#143832)
  Document CHANGE_POINT limitation (elastic#143877)
  Fix OperationsOnSeqNoDisabledIndicesIT (elastic#143892)
  [Test] Test that sequence numbers are not pruned with retention lease (elastic#143825)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. Team:Distributed Meta label for distributed team. >test Issues or PRs that are addressing/adding tests v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants