Skip to content

Conversation

Ankith-Confluent
Copy link
Member

@Ankith-Confluent Ankith-Confluent commented Sep 22, 2025

This PR refactors the librdkafka test suite to improve cloud compatibility by adding configurable options in test.conf. This enables better test portability and maintainability across different Kafka environments.

Changes

1. Configurable Test Framework

  • test.skip.idempotent: Skip tests requiring idempotent producer (replaces -I flag)
  • test.supported.acks: Configure supported acknowledgment values (e.g., -1,0,1)
  • test.sleep.multiplier: Configurable sleep multiplier for different environments. Multiplies explicit sleep_for() delays for cluster state propagation (set 0 to skip sleeps), different from test.timeout.multiplier which multiplies API operation timeouts (can't be disabled).
  • test.timeout.multiplier: Unified timeout scaling (existing feature, now consistently used)
  • test.skip.numbers: Skip specific tests by number (comma-separated list)

2. Topic Cleanup

  • Many tests were creating topics, but not deleting them.
  • Added topic delete utility.

3. Replication Factor

  • Changed hardcoded replication factors to use broker defaults (-1)

4. Preprocessor Directives for Version Compatibility

  • Added preprocessor directives to support librdkafka versions 2.0 through 2.11

🔧 Configuration Examples

test.timeout.multiplier=2.0
test.sleep.multiplier=3.0
test.supported.acks=-1,1
test.skip.idempotent=true
test.skip.numbers=0011,0055,0063,0068,0081,0086

@Ankith-Confluent Ankith-Confluent requested a review from a team as a code owner September 24, 2025 12:40
@Copilot Copilot AI review requested due to automatic review settings September 24, 2025 12:40
Copy link
Member

@k-raina k-raina left a comment

Choose a reason for hiding this comment

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

Please update PR description, since there are large amount of changes. It will help with review

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements testing support for K2 (Kafka-compatible) clusters by adding comprehensive configuration options and adapting tests to work with different cluster environments. The changes enable tests to handle varying acks support, idempotent producer requirements, and cloud/managed cluster constraints.

  • Added K2 cluster detection and configuration support with timeout adjustments
  • Implemented flexible acks value testing and cluster-specific feature detection
  • Enhanced test framework with version-aware APIs and graceful degradation for older librdkafka versions

Reviewed Changes

Copilot reviewed 91 out of 91 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/testshared.h Added function declarations for K2 cluster support, acks validation, and topic creation utilities
tests/test.h Added TEST_F_IDEMPOTENT_PRODUCER flag and K2 cluster variable declaration
tests/test.conf.example Added configuration options for test skipping, acks support, sleep multipliers, and idempotent producer handling
tests/test.c Core implementation of K2 support, acks validation, test skipping logic, and enhanced test framework functions
Multiple test files Updated individual tests to use broker-default replication factors, version-aware APIs, and conditional test execution

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 95 out of 95 changed files in this pull request and generated 10 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@k-raina k-raina left a comment

Choose a reason for hiding this comment

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

First round of review. Left some comments!

Copy link
Member

@k-raina k-raina 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 changes!
Few comments for rest of files.

… Removed deprecated `safe_print_partition_list` and replaced its usage with `test_print_partition_list_with_errors` and `test_print_partition_list_no_errors` across multiple test files.
…cy and clarity. Updated all instances of test_sleep to sleep_for across multiple test files, ensuring uniformity in sleep duration handling.
…guration. Updated test files to eliminate conditional logic related to K2 clusters, ensuring consistent fetch limits across all tests.
…y. Adjusted fetch.max.bytes and receive.message.max.bytes settings to improve test reliability. Modified topic creation functions to ensure topics are created with the correct parameters across multiple test cases.
…out-based waits. Updated tests to accommodate cloud environments with higher latencies, ensuring rebalancing operations complete reliably. Expanded error handling in commit callbacks to include additional scenarios that may occur during rebalancing.
…djusting timeout handling for cloud environments. Added checks for partition existence and refined error handling for GROUP resource configurations, ensuring compatibility with managed Kafka services.
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.

2 participants