Add more Cassandra batch testing#19038
Open
trask wants to merge 5 commits into
Open
Conversation
5f1fc9e to
826add8
Compare
826add8 to
79153fd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates and expands the Cassandra batch-statement test coverage ahead of upcoming core DB batch semantic-convention changes. It replaces the two separate batch tests (batchStatementWithSameQuery and batchStatementWithDifferentQueries) with a single parameterized batchStatement test driven by a BatchScenario builder, and adds two new scenarios (empty batch and single-statement batch) to pin current behavior. The change is applied symmetrically to the Cassandra 3.x javaagent test and the shared Cassandra 4.x AbstractCassandraTest (used by the 4.0/4.4 modules).
Changes:
- Parameterized the batch test with four scenarios:
empty,single,twoSameOperation,twoDifferentOperations, each pinning span name, statement, batch size, query summary, and operation/table for both stable and old semconv. - Introduced a
BatchScenario+Buildertest helper to express each scenario declaratively (with aFunction<Session, BatchStatement>to construct the batch). - Moved statement preparation into each scenario's batch builder (safe, since
prepare()is not traced by the Cassandra instrumentation).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| instrumentation/cassandra/cassandra-3.0/javaagent/src/test/java/.../v3_0/CassandraClientTest.java | Replaces two batch tests with a parameterized batchStatement test plus BatchScenario helper covering empty/single/multi cases. |
| instrumentation/cassandra/cassandra-common-4.0/testing/src/main/java/.../v4_0/AbstractCassandraTest.java | Same parameterized batch refactor for the shared 4.x test base, adding empty/single scenarios and DB_OPERATION/DB_CASSANDRA_TABLE assertions. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add current-behavior batch coverage for Cassandra 3.x javaagent instrumentation and the shared Cassandra 4.x tests before the core DB batch semantic changes land (open-telemetry/semantic-conventions#3811). The tests pin empty batch fallback behavior, single-statement batch handling, stable-semconv multi-statement batch names and summaries with
db.operation.batch.size, and old-semconv generic multi-query behavior.