Skip to content

MLE-33561: Purge unrecoverable dead test code - #1986

Merged
vishwach merged 1 commit into
developfrom
MLE-33561
Nov 17, 2026
Merged

vishwach merged 1 commit into
developfrom
MLE-33561

Conversation

@vishwach

@vishwach vishwach commented Nov 4, 2026 •

Copy link
Copy Markdown

This PR cleans up historical dead test debt across the test suite by permanently removing 7 dead code sites (unexecuted Early Access prototypes, unfinished plan builders, commented-out test stubs, orphaned batcher helpers, and obsolete comment banners) along with their unused imports and fixtures.

None of these sites were active tests in CI. Their removal eliminates codebase clutter and confusion with zero loss in test coverage.

Detailed Breakdown of Purged Dead Code Sites

# File & Location Nature of Code Why Safe to Delete & Where Covered
1 StringQueryHostBatcherTest.java:741
testQueryBatcherQueryFailures
Commented-out // @Test Fully covered elsewhere. Host failure and retry callbacks are actively tested in QueryBatcherTest and HostAvailabilityListenerTest.
2 WriteHostBatcherTest.java:2170
testDisableDBDuringInsert
Commented-out // @Test Fully covered elsewhere. Mid-stream write errors and socket resets are covered in WriteBatcherFailureTest and active WriteHostBatcherTest listener suites.
3 WriteHostBatcherTest.java
(Additional site / Orphaned helper)
Orphaned helper method / fixture Orphaned code removal. Had zero active callers once testDisableDBDuringInsert was purged; removed to keep -Werror clean.
4 TestOpticOnLiterals.java:1093
testBuiltInFns
Incomplete EA-3 draft (no @Test, zero assertions) Fully covered elsewhere. Optic built-ins are exhaustively tested in OpticOnLiteralsTest, OpticPlanTest, and PlanGeneratedTest.
5 TestAppServerConstraints.java:155
testWithWordConstraintAndGoogleGrammar
Incomplete EA-3 draft with no assertions Fully covered elsewhere. Query grammar and word constraints are tested in SearchQueryDefinitionTest and TestQueryOptionBuilder.
6 TestPOJOReadWriteWithTransactions.java:294
test4POJOSearchWithCollectionsandTransaction
Unannotated method (missing @Test, never run) Fully covered elsewhere. POJO multi-statement transaction CRUD is covered by adjacent tests in the same class and PojoRepositoryTest.
7 TestQueryOptionBuilder.java:1768
(Comment block only)
Leftover comment headers (Begin/End) referencing tests deleted before 4.0.2 Pure comment cleanup. No code existed. Query sorting options are thoroughly tested across TestQueryOptionBuilder. Active test logic was preserved to avoid conflict with MLE-32873.

Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:50
@vishwach
vishwach marked this pull request as draft November 4, 2026 08:50

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.

🟢 Approval recommended

No active review issues are blocking approval.

No open issues 🎉

What changed in this PR

Removes dead code and unused resources from the functional-test module without changing production code or JUnit-discovered tests.

Changes:

  • Deletes unfinished methods without @Test and obsolete commented-out test code.
  • Removes the associated database-disabling helper and unused query-options fixture.
  • Deletes a stale comment about issue #347; query-option behavior is unchanged.

Paths below are relative to marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/.

File Description
functionaltest/​queryoptions/​collectionConstraintWithWordConstraintAndGoogleGrammarOpt.xml Deletes the unused query-options fixture.
fastfunctest/​TestQueryOptionBuilder.java Removes only the stale issue #347 comment block.
fastfunctest/​TestPOJOReadWriteWithTransactions.java Removes an undiscovered collection-search transaction test.
fastfunctest/​TestOpticOnLiterals.java Removes an unfinished built-in functions test.
fastfunctest/​TestAppServerConstraints.java Removes the undiscovered Google-grammar constraint test.
datamovement/​functionaltests/​WriteHostBatcherTest.java Removes an unfinished database-disable test and its helper class.
datamovement/​functionaltests/​StringQueryHostBatcherTest.java Removes an unfinished query-failure test and commented-out batcher contention test.

Review effort: Balanced

@prgs-rsingh

Copy link
Copy Markdown

Verified that removing these disabled/commented-out methods does not lose functional test coverage:

  1. StringQueryHostBatcherTest.testQueryBatcherQueryFailures — Covered by QueryBatcherInitialQueryFailsTest.jobStopsWhenQueryIsInvalid, QueryBatcherFailureTest, and StringQueryHostBatcherTest.testQueryBatcherFailures.
  2. StringQueryHostBatcherTest.testSimultaneousBothBatcherAccess — Covered by StringQueryHostBatcherTest.testQueryBatcherCallbackClient, DeleteListenerTest, and ApplyTransformListenerTest.
  3. WriteHostBatcherTest.testDisableDBDuringInsert — Covered by WriteHostBatcherTest.testDisableAppServerDuringInsert and testNoHost.
  4. TestOpticOnLiterals.testBuiltInFns — Covered by PlanGeneratedTest (testFnCurrentDate0, testFnUpperCase1, testMathLog101, testSemIsLiteral1) and TestOpticOnViews.
  5. TestAppServerConstraints.testWithWordConstraintAndGoogleGrammar — Covered by TestAppServerConstraints.testWithAll (strict superset using the same documents, collections, and (coll:set1 AND coll:set5) AND -intitle:memex criteria).

Minor note on TestPOJOReadWriteWithTransactions.test4POJOSearchWithCollectionsandTransaction:
While PojoRepositoryImpl.search(long start, Transaction transaction, String... collections) is a 1-line delegation to search(qb.collection(collections), start, null, transaction) (which is covered by test2 and test5), test4 was the only place in the test suite referencing the search(long, Transaction, String...) overload directly.

Consider adding a quick check inside test5POJOSearchWithQueryDefinitionandTransaction (around line 313, right after the products.count(...) assertions) so that public overload stays exercised:

assertEquals(0, products.search(1, "even").getTotalSize());
assertEquals(55, products.search(1, t, "even").getTotalSize());

@vishwach
vishwach marked this pull request as ready for review November 17, 2026 08:05

@prgs-rsingh prgs-rsingh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified that all 7 removed dead test sites and orphaned fixtures are already covered by active tests and all CI/Jenkins checks are green.

@vishwach
vishwach merged commit 1ff0498 into develop Nov 17, 2026
4 checks passed
@vishwach
vishwach deleted the MLE-33561 branch November 17, 2026 16:48
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.

4 participants