Skip to content

Fix Java test path duplication when tests_root includes package path#1282

Merged
HeshamHM28 merged 1 commit intoomni-javafrom
fix/java-test-path-duplication
Feb 3, 2026
Merged

Fix Java test path duplication when tests_root includes package path#1282
HeshamHM28 merged 1 commit intoomni-javafrom
fix/java-test-path-duplication

Conversation

@HeshamHM28
Copy link
Contributor

@HeshamHM28 HeshamHM28 commented Feb 3, 2026

Fix Java test path duplication when tests_root includes package path

Problem

When running Java optimization with a tests_root that already includes the Java package path (e.g.,
test/src/com/aerospike/test), generated test files were being written to incorrect duplicated paths:

WARNING  Test type not found for '/Users/.../test/src/com/aerospike/test/SuiteSync.java'.
           Registered test files:
           ['/Users/.../test/src/com/aerospike/test/com/aerospike/client/util/UnpackerTest__perfinstrumented.java',
            '/Users/.../test/src/com/aerospike/test/com/aerospike/client/util/UnpackerTest__perfinstrumented_2.java']
  INFO     Tests '[None, None]' failed to run, skipping

Duplicated path structure: test/src/com/aerospike/test/com/aerospike/client/util/...

This caused:

  • Test files written to wrong locations
  • original_file_path returning None for generated tests
  • Behavioral tests failing to run with Tests '[None, None]' failed to run

Root Cause

In _fix_java_test_paths(), the code used self.test_cfg.tests_root directly and appended the package path from the
generated test source. When tests_root already contained the package structure (test/src/com/aerospike/test),
appending the test's package (com.aerospike.client.util) created a duplicated path.

Solution

Added _get_java_sources_root() method that:

  1. Detects standard Java package prefixes (com, org, net, io, edu, gov) in tests_root
  2. Returns the base directory before the package structure (e.g., test/src instead of test/src/com/aerospike/test)
  3. Falls back to Maven-style java directory detection
  4. Defaults to original tests_root if no pattern matches

Result

Before: test/src/com/aerospike/test/com/aerospike/client/util/UnpackerTest__perfinstrumented.java

After: test/src/com/aerospike/client/util/UnpackerTest__perfinstrumented.java

@HeshamHM28 HeshamHM28 merged commit 5c61000 into omni-java Feb 3, 2026
18 of 27 checks passed
@HeshamHM28 HeshamHM28 deleted the fix/java-test-path-duplication branch February 3, 2026 17:59
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