Skip to content

Conversation

@HofmeisterAn
Copy link
Collaborator

@HofmeisterAn HofmeisterAn commented Dec 13, 2025

What does this PR do?

This PR updates the Kafka versions. The Kafka module is now using the latest patch of the default image.

I'm not entirely sure what caused it, but the previous versions sometimes crashed on container startup. While testing in GH Codespaces, the old versions would fail after a few runs with various errors, usually pointing to a container crash at startup.

With the updated versions, I haven't seen any issues. I ran Codespaces for several hours without failures, whereas the old versions would fail quickly.

Why is it important?

Remove flakiness.

Related issues

Summary by CodeRabbit

  • Chores
    • Default Kafka container image updated from version 7.5.9 to 7.5.12 in the builder
    • Test container images upgraded: Kafka updated from version 3.9.1 to 4.1.1, Kafka-native upgraded from 3.9.1 to 4.1.1
    • Test configurations updated accordingly to work with the new container image versions

✏️ Tip: You can customize this high-level summary in your review settings.

@HofmeisterAn HofmeisterAn added bug Something isn't working chore A change that doesn't impact the existing functionality, e.g. internal refactorings or cleanups test flakiness A flaky test labels Dec 13, 2025
@netlify
Copy link

netlify bot commented Dec 13, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 826f9bd
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/693d36f21576130008b5a078
😎 Deploy Preview https://deploy-preview-1604--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

Kafka component versions are upgraded across the codebase to resolve test timeout issues in GitHub Actions. The default KafkaBuilder image is updated from 7.5.9 to 7.5.12, test Docker images are bumped to newer versions, and corresponding test configurations are updated to reference the new image tags.

Changes

Cohort / File(s) Summary
KafkaBuilder constant and documentation
src/Testcontainers.Kafka/KafkaBuilder.cs
Public constant KafkaImage updated from "confluentinc/cp-kafka:7.5.9" to "confluentinc/cp-kafka:7.5.12"; XML documentation examples reflecting the new tag in class and constructor docstrings.
Test Docker base images
tests/Testcontainers.Kafka.Tests/Dockerfile
Dockerfile base image tags updated: cp-kafka:7.5.9cp-kafka:7.5.12, kafka:3.9.1kafka:4.1.1, kafka-native:3.9.1kafka-native:4.1.1.
Test container configurations
tests/Testcontainers.Kafka.Tests/KafkaContainerTest.cs
Test stage references updated: ApacheKafkaConfiguration uses "kafka4.1.1" instead of "kafka3.9.1", ApacheKafkaNativeConfiguration uses "kafka-native4.1.1" instead of "kafka-native3.9.1".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify version bump consistency across all three files
  • Confirm the new Kafka versions (7.5.12, 4.1.1) are stable and compatible with the existing test suite
  • Check that no additional configuration or breaking changes are required for the newer image versions

Poem

🐰 A Kafka of newer vintage,
Seven-dot-five now dances with grandeur,
From 7.5.9 to 7.5.12 we spring,
Tests no longer hang in the night,
GitHub Actions flows with delight! 📦

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: bumping Kafka image versions to fix container startup crashes.
Description check ✅ Passed The description includes all mandatory sections (What and Why) and links the related issue. It provides clear context for the version bump.
Linked Issues check ✅ Passed The PR addresses the primary objective from issue #1597 by updating Kafka image versions to resolve random test failures and container startup crashes reported in CI runs.
Out of Scope Changes check ✅ Passed All changes are directly related to updating Kafka image versions across the codebase, with no unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/bump-kafka-versions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92af06f and 826f9bd.

📒 Files selected for processing (3)
  • src/Testcontainers.Kafka/KafkaBuilder.cs (2 hunks)
  • tests/Testcontainers.Kafka.Tests/Dockerfile (1 hunks)
  • tests/Testcontainers.Kafka.Tests/KafkaContainerTest.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: diegosasw
Repo: testcontainers/testcontainers-dotnet PR: 1583
File: src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj:7-7
Timestamp: 2025-11-17T17:58:43.958Z
Learning: In the testcontainers-dotnet repository, JetBrains.Annotations should use version 2023.3.0 to maintain consistency with the main Testcontainers csproj, rather than always using the latest available version.
📚 Learning: 2025-11-17T17:58:43.958Z
Learnt from: diegosasw
Repo: testcontainers/testcontainers-dotnet PR: 1583
File: src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj:7-7
Timestamp: 2025-11-17T17:58:43.958Z
Learning: In the testcontainers-dotnet repository, JetBrains.Annotations should use version 2023.3.0 to maintain consistency with the main Testcontainers csproj, rather than always using the latest available version.

Applied to files:

  • tests/Testcontainers.Kafka.Tests/KafkaContainerTest.cs
  • tests/Testcontainers.Kafka.Tests/Dockerfile
  • src/Testcontainers.Kafka/KafkaBuilder.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: ci (Testcontainers.Kafka, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers, ubuntu-24.04)
  • GitHub Check: analyze (csharp)
🔇 Additional comments (3)
tests/Testcontainers.Kafka.Tests/KafkaContainerTest.cs (1)

102-102: LGTM! Stage names correctly updated.

The stage parameter updates align perfectly with the Dockerfile aliases. Both ApacheKafkaConfiguration and ApacheKafkaNativeConfiguration now reference the new Kafka 4.1.1 images, maintaining consistency across the test suite.

Also applies to: 112-112

src/Testcontainers.Kafka/KafkaBuilder.cs (1)

8-8: LGTM! Default image version updated consistently.

The patch version bump from 7.5.9 to 7.5.12 addresses the container crash issue mentioned in the PR objectives. Both the constant and its documentation example are updated consistently, ensuring users see the correct version reference.

Also applies to: 42-42

tests/Testcontainers.Kafka.Tests/Dockerfile (1)

1-1: Confirm the Dockerfile and KafkaBuilder.cs are aligned on the Kafka version.

Both the Dockerfile and KafkaBuilder.cs specify version 7.5.12 of the cp-kafka image, maintaining consistency across the codebase.

@HofmeisterAn HofmeisterAn merged commit 2218693 into develop Dec 13, 2025
16 checks passed
@HofmeisterAn HofmeisterAn deleted the bugfix/bump-kafka-versions branch December 13, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chore A change that doesn't impact the existing functionality, e.g. internal refactorings or cleanups test flakiness A flaky test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Kafka tests fail randomly when run by GH actions

2 participants