Skip to content

[ZEPPELIN-6639] Migrate Cassandra interpreter tests to Testcontainers with Cassandra 4.x - #5412

Open
pan3793 wants to merge 1 commit into
apache:masterfrom
pan3793:ZEPPELIN-6639
Open

[ZEPPELIN-6639] Migrate Cassandra interpreter tests to Testcontainers with Cassandra 4.x#5412
pan3793 wants to merge 1 commit into
apache:masterfrom
pan3793:ZEPPELIN-6639

Conversation

@pan3793

@pan3793 pan3793 commented Aug 11, 2026

Copy link
Copy Markdown
Member

What is this PR for?

The Cassandra interpreter tests use cassandra-unit which embeds Cassandra 3.11.5 in-process. Cassandra 3.x is EOL (unmaintained, archived) and crashes on JDK 17 because Unsafe.objectFieldOffset() on hidden classes (lambdas) throws UnsupportedOperationException during PREPARE statement storage -- a hard JVM restriction no flag can override. This PR migrates the tests to Testcontainers with Cassandra 4.1.3 (the latest maintained 4.1.x), which handles JDK 17 correctly. This is a prerequisite for JDK 17 support.

What type of PR is it?

Improvement

What is the Jira issue?

https://issues.apache.org/jira/browse/ZEPPELIN-6639

How should this be tested?

  • cassandra module: 39 tests pass on JDK 11 and JDK 17 with Docker
  • ./mvnw test -pl cassandra

Questions

  • Does the licenses file need update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

Details

  • Replace cassandra-unit dependency with org.testcontainers:cassandra (cassandra:4.1.3 image)
  • Add org.testcontainers:cassandra to root pom.xml dependencyManagement
  • Rewrite CassandraInterpreterTest to use CassandraContainer instead of EmbeddedCassandraServerHelper
  • Load CQL test data via CqlSession instead of CQLDataLoader
  • Update test expectation HTML files to match Cassandra 4.x table option output:
    • additional_write_policy = '99p' (new in 4.x)
    • read_repair = 'BLOCKING' (replaces dclocal_read_repair_chance + read_repair_chance)
    • speculative_retry = '99p' (replaces '99PERCENTILE')
    • compression chunk_length_in_kb = 16 (was 64)
    • NoResultWithExecutionInfo.html: replace hardcoded localhost:9142 with TRIED_HOSTS/QUERIED_HOSTS placeholders
  • Normalize localhost/<unresolved>:port in test assertions (JDK 17+ InetSocketAddress.toString() renders unresolved addresses differently)

Assisted-by: GLM 5.2

Cassandra 3.x crashes on JDK 17 because Unsafe.objectFieldOffset() on
hidden classes (lambdas) throws UnsupportedOperationException during
PREPARE statement storage. This is a hard JVM restriction no flag can
override. Cassandra 4.x handles this correctly.

- Replace cassandra-unit with Testcontainers cassandra:4.1.3
- Rewrite CassandraInterpreterTest to use CassandraContainer
- Update test expectation HTML files for Cassandra 4.x table options
- Normalize localhost/<unresolved> InetSocketAddress format in assertions
  (JDK 17+ renders unresolved addresses differently)

Assisted-by: GLM 5.2
@pan3793
pan3793 requested a review from jongyoul August 11, 2026 09:13
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