Skip to content

Commit

Permalink
add missing checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld committed Feb 21, 2025
1 parent 8859efb commit 432e102
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
- name: Check Kafka logs for unexpected warnings
run: bin/verify_kafka_warnings

- name: Check test topics naming convention
run: bin/verify_topics_naming

diffend:
runs-on: ubuntu-latest
strategy:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# WaterDrop changelog

## 2.8.3 (Unreleased)
- [Refactor] Introduce a `bin/verify_topics_naming` script to ensure proper test topics naming convention.

## 2.8.2 (2025-02-13)
- [Feature] Allow for tagging of producer instances similar to how consumers can be tagged.
- [Refactor] Ensure all test topics in the test suite start with "it-" prefix.
- [Refactor] Introduce a `bin/verify_kafka_warnings` script to clean Kafka from temporary test-suite topics.

## 2.8.1 (2024-12-26)
- [Enhancement] Raise `WaterDrop::ProducerNotTransactionalError` when attempting to use transactions on a non-transactional producer.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
waterdrop (2.8.2)
waterdrop (2.8.3)
karafka-core (>= 2.4.3, < 3.0.0)
karafka-rdkafka (>= 0.17.5)
zeitwerk (~> 2.3)
Expand Down
28 changes: 28 additions & 0 deletions bin/verify_topics_naming
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env ruby

# This script verifies that we do not create (except few needed exceptions) test topics that do
# not start with the "it-" prefix which is our standard.
#
# This ensures that we can clearly identify all test topics for removal in case of doing dev work
# on a long-lived Kafka cluster without option to fully reset it.
#
# It also ensures we have one convention that we can follow.

require 'rdkafka'

admin = Rdkafka::Config.new('bootstrap.servers': 'localhost:9092').admin

invalid = admin
.metadata
.topics
.map { |topic| topic[:topic_name] }
.select { |topic| !topic.start_with?('it-') }
.select { |topic| topic.length <= 6 }

admin.close

invalid.each do |invalid_name|
puts "#{invalid_name} does not start with the \"it-\" prefix"
end

exit invalid.empty? ? 0 : 1
2 changes: 1 addition & 1 deletion lib/waterdrop/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# WaterDrop library
module WaterDrop
# Current WaterDrop version
VERSION = '2.8.2'
VERSION = '2.8.3'
end

0 comments on commit 432e102

Please sign in to comment.