karafka-testing 2.5.2 → 2.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +23 -9
- data/.github/workflows/push.yml +2 -2
- data/.github/workflows/verify-action-pins.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +17 -8
- data/karafka-testing.gemspec +2 -2
- data/lib/karafka/testing/helpers.rb +19 -11
- data/lib/karafka/testing/minitest/helpers.rb +3 -0
- data/lib/karafka/testing/rspec/helpers.rb +4 -1
- data/lib/karafka/testing/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0bac7810f07fb9324256c1cdb77d41a703a9b4d9333de1f191d74502fc93948
|
4
|
+
data.tar.gz: 1d4a0400c7e7784f377eae9a2bf94ff4046a8c21214844019a2300c71b1c4e9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27c816ab440addf35afde363c2ad742b02089ea2b1b863e33087d80d2284bac83b6cbe1bc62fee3eebfff7bd50126a80e8f10fe9c9c9b1df9c8396b00cb7af15
|
7
|
+
data.tar.gz: 31ef6e3808dc2e2c5263c981974c0b360749c02cf8ac8d3a9dee9339f6dd909b2bdd871e9bcc33ffcbcc987ba240e005828e556fae46e78563cc970278e20e14
|
data/.github/workflows/ci.yml
CHANGED
@@ -6,9 +6,7 @@ concurrency:
|
|
6
6
|
|
7
7
|
on:
|
8
8
|
pull_request:
|
9
|
-
branches: [
|
10
|
-
push:
|
11
|
-
branches: [ main, master ]
|
9
|
+
branches: [ master ]
|
12
10
|
schedule:
|
13
11
|
- cron: '0 1 * * *'
|
14
12
|
|
@@ -28,12 +26,11 @@ jobs:
|
|
28
26
|
- '3.4'
|
29
27
|
- '3.3'
|
30
28
|
- '3.2'
|
31
|
-
- '3.1'
|
32
29
|
include:
|
33
30
|
- ruby: '3.3'
|
34
31
|
coverage: 'true'
|
35
32
|
steps:
|
36
|
-
- uses: actions/checkout@
|
33
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
37
34
|
with:
|
38
35
|
fetch-depth: 0
|
39
36
|
|
@@ -41,7 +38,7 @@ jobs:
|
|
41
38
|
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
42
39
|
|
43
40
|
- name: Set up Ruby
|
44
|
-
uses: ruby/setup-ruby@
|
41
|
+
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
|
45
42
|
with:
|
46
43
|
ruby-version: ${{matrix.ruby}}
|
47
44
|
bundler: 'latest'
|
@@ -62,12 +59,12 @@ jobs:
|
|
62
59
|
strategy:
|
63
60
|
fail-fast: false
|
64
61
|
steps:
|
65
|
-
- uses: actions/checkout@
|
62
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
66
63
|
with:
|
67
64
|
fetch-depth: 0
|
68
65
|
|
69
66
|
- name: Set up Ruby
|
70
|
-
uses: ruby/setup-ruby@
|
67
|
+
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
|
71
68
|
with:
|
72
69
|
ruby-version: 3.3
|
73
70
|
|
@@ -86,7 +83,7 @@ jobs:
|
|
86
83
|
strategy:
|
87
84
|
fail-fast: false
|
88
85
|
steps:
|
89
|
-
- uses: actions/checkout@
|
86
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
90
87
|
with:
|
91
88
|
fetch-depth: 0
|
92
89
|
|
@@ -106,3 +103,20 @@ jobs:
|
|
106
103
|
|
107
104
|
- name: Run Coditsu
|
108
105
|
run: ./coditsu_script.sh
|
106
|
+
|
107
|
+
ci-success:
|
108
|
+
name: CI Success
|
109
|
+
runs-on: ubuntu-latest
|
110
|
+
if: always()
|
111
|
+
needs:
|
112
|
+
- diffend
|
113
|
+
- coditsu
|
114
|
+
- specs
|
115
|
+
steps:
|
116
|
+
- name: Check all jobs passed
|
117
|
+
if: |
|
118
|
+
contains(needs.*.result, 'failure') ||
|
119
|
+
contains(needs.*.result, 'cancelled') ||
|
120
|
+
contains(needs.*.result, 'skipped')
|
121
|
+
run: exit 1
|
122
|
+
- run: echo "All CI checks passed!"
|
data/.github/workflows/push.yml
CHANGED
@@ -19,12 +19,12 @@ jobs:
|
|
19
19
|
id-token: write
|
20
20
|
|
21
21
|
steps:
|
22
|
-
- uses: actions/checkout@
|
22
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
23
23
|
with:
|
24
24
|
fetch-depth: 0
|
25
25
|
|
26
26
|
- name: Set up Ruby
|
27
|
-
uses: ruby/setup-ruby@
|
27
|
+
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
|
28
28
|
with:
|
29
29
|
bundler-cache: false
|
30
30
|
|
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
verify_action_pins:
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
steps:
|
10
|
-
- uses: actions/checkout@
|
10
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
11
11
|
- name: Check SHA pins
|
12
12
|
run: |
|
13
13
|
if grep -E -r "uses: .*/.*@(v[0-9]+|main|master)($|[[:space:]]|$)" --include="*.yml" --include="*.yaml" .github/workflows/ | grep -v "#"; then
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Karafka Testing Changelog
|
2
2
|
|
3
|
+
## 2.5.4 (2025-10-03)
|
4
|
+
- [Fix] Topic present in second dynamically built subscription group not available for dispatch (#291).
|
5
|
+
- [Change] Remove Ruby `3.1` according to the EOL schedule.
|
6
|
+
|
7
|
+
## 2.5.3 (2025-08-12)
|
8
|
+
- [Fix] Allow testing consumers with Pro expansions (i.e. Piping).
|
9
|
+
|
3
10
|
## 2.5.2 (2025-08-04)
|
4
11
|
- [Enhancement] Change RSpec hook execution order issue in Karafka testing helpers.
|
5
12
|
- [Change] Remove `funding_uri` from the gemspec to minimize double-funding info.
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-testing (2.5.
|
5
|
-
karafka (>= 2.5.0
|
4
|
+
karafka-testing (2.5.4)
|
5
|
+
karafka (>= 2.5.0, < 2.6.0)
|
6
6
|
waterdrop (>= 2.8.0)
|
7
7
|
|
8
8
|
GEM
|
@@ -11,17 +11,26 @@ GEM
|
|
11
11
|
base64 (0.2.0)
|
12
12
|
ffi (1.17.0)
|
13
13
|
ffi (1.17.0-x86_64-linux-gnu)
|
14
|
-
|
14
|
+
json (2.13.2)
|
15
|
+
karafka (2.5.0)
|
15
16
|
base64 (~> 0.2)
|
16
|
-
karafka-core (>= 2.5.
|
17
|
-
karafka-rdkafka (>= 0.19.
|
17
|
+
karafka-core (>= 2.5.2, < 2.6.0)
|
18
|
+
karafka-rdkafka (>= 0.19.5)
|
18
19
|
waterdrop (>= 2.8.3, < 3.0.0)
|
19
20
|
zeitwerk (~> 2.3)
|
20
|
-
karafka-core (2.5.
|
21
|
-
karafka-rdkafka (>= 0.
|
21
|
+
karafka-core (2.5.6)
|
22
|
+
karafka-rdkafka (>= 0.20.0)
|
22
23
|
logger (>= 1.6.0)
|
23
|
-
karafka-rdkafka (0.
|
24
|
+
karafka-rdkafka (0.21.0)
|
24
25
|
ffi (~> 1.15)
|
26
|
+
json (> 2.0)
|
27
|
+
logger
|
28
|
+
mini_portile2 (~> 2.6)
|
29
|
+
rake (> 12)
|
30
|
+
karafka-rdkafka (0.21.0-x86_64-linux-gnu)
|
31
|
+
ffi (~> 1.15)
|
32
|
+
json (> 2.0)
|
33
|
+
logger
|
25
34
|
mini_portile2 (~> 2.6)
|
26
35
|
rake (> 12)
|
27
36
|
logger (1.7.0)
|
data/karafka-testing.gemspec
CHANGED
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = %w[lib]
|
21
21
|
|
22
|
-
spec.add_dependency 'karafka', '>= 2.5.0
|
22
|
+
spec.add_dependency 'karafka', '>= 2.5.0', '< 2.6.0'
|
23
23
|
spec.add_dependency 'waterdrop', '>= 2.8.0'
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 3.
|
25
|
+
spec.required_ruby_version = '>= 3.2.0'
|
26
26
|
|
27
27
|
spec.metadata = {
|
28
28
|
'homepage_uri' => 'https://karafka.io',
|
@@ -15,17 +15,25 @@ module Karafka
|
|
15
15
|
# @note Since we run the lookup on subscription groups, the search will automatically
|
16
16
|
# expand with matching patterns
|
17
17
|
def karafka_consumer_find_candidate_topics(requested_topic, requested_consumer_group)
|
18
|
-
karafka_consumer_find_subscription_groups(requested_consumer_group)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
subscription_groups = karafka_consumer_find_subscription_groups(requested_consumer_group)
|
19
|
+
|
20
|
+
candidate_topics = []
|
21
|
+
|
22
|
+
subscription_groups.each do |group|
|
23
|
+
topic = group.topics.find(requested_topic.to_s)
|
24
|
+
|
25
|
+
next unless topic
|
26
|
+
|
27
|
+
candidate_topics << topic
|
28
|
+
rescue Karafka::Errors::TopicNotFoundError
|
29
|
+
# Skip groups that don't have the requested topic
|
30
|
+
next
|
31
|
+
end
|
32
|
+
|
33
|
+
# Remove duplicate topics from multiplexed subscriptions
|
34
|
+
# (Multiplexed subscriptions share the same name, and during testing
|
35
|
+
# there's no parallel execution anyway, so we only need the first one)
|
36
|
+
candidate_topics.uniq { |topic| topic.subscription_group.name }
|
29
37
|
end
|
30
38
|
|
31
39
|
# Finds subscription groups from the requested consumer group or selects all if no
|
@@ -190,6 +190,7 @@ module Karafka
|
|
190
190
|
coordinators = Karafka::Processing::CoordinatorsBuffer.new(
|
191
191
|
Karafka::Routing::Topics.new([topic])
|
192
192
|
)
|
193
|
+
processing_cfg = Karafka::App.config.internal.processing
|
193
194
|
@consumer = topic.consumer.new
|
194
195
|
@consumer.producer = Karafka::App.producer
|
195
196
|
# Inject appropriate strategy so needed options and components are available
|
@@ -200,6 +201,8 @@ module Karafka
|
|
200
201
|
@consumer.coordinator.seek_offset = 0
|
201
202
|
# Indicate usage as for tests no direct enqueuing happens
|
202
203
|
@consumer.instance_variable_set('@used', true)
|
204
|
+
expansions = processing_cfg.expansions_selector.find(topic)
|
205
|
+
expansions.each { |expansion| @consumer.singleton_class.include(expansion) }
|
203
206
|
@_karafka_consumer_mappings[topic.name] = @consumer
|
204
207
|
@consumer
|
205
208
|
end
|
@@ -201,16 +201,19 @@ module Karafka
|
|
201
201
|
Karafka::Routing::Topics.new([topic])
|
202
202
|
)
|
203
203
|
|
204
|
+
processing_cfg = Karafka::App.config.internal.processing
|
204
205
|
consumer = topic.consumer.new
|
205
206
|
consumer.producer = Karafka::App.producer
|
206
207
|
# Inject appropriate strategy so needed options and components are available
|
207
|
-
strategy =
|
208
|
+
strategy = processing_cfg.strategy_selector.find(topic)
|
208
209
|
consumer.singleton_class.include(strategy)
|
209
210
|
consumer.client = _karafka_consumer_client
|
210
211
|
consumer.coordinator = coordinators.find_or_create(topic.name, 0)
|
211
212
|
consumer.coordinator.seek_offset = 0
|
212
213
|
# Indicate usage as for tests no direct enqueuing happens
|
213
214
|
consumer.instance_variable_set('@used', true)
|
215
|
+
expansions = processing_cfg.expansions_selector.find(topic)
|
216
|
+
expansions.each { |expansion| consumer.singleton_class.include(expansion) }
|
214
217
|
|
215
218
|
@_karafka_consumer_mappings[topic.name] = consumer
|
216
219
|
consumer
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -15,7 +15,7 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.5.0
|
18
|
+
version: 2.5.0
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.6.0
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 2.5.0
|
28
|
+
version: 2.5.0
|
29
29
|
- - "<"
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: 2.6.0
|
@@ -101,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 3.
|
104
|
+
version: 3.2.0
|
105
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ">="
|