karafka-testing 2.2.2 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +27 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +17 -21
- data/karafka-testing.gemspec +2 -2
- data/lib/karafka/testing/errors.rb +11 -1
- data/lib/karafka/testing/minitest/helpers.rb +3 -0
- data/lib/karafka/testing/rspec/helpers.rb +3 -0
- data/lib/karafka/testing/version.rb +1 -1
- data/lib/karafka/testing.rb +27 -0
- data.tar.gz.sig +0 -0
- metadata +9 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5e94cc98b3418a25cd549e4e9f4851d22fa819b499b77185afb7ee1e1f10c6
|
4
|
+
data.tar.gz: 415e32601301d2f07de6c575109c443af8f489c178041e387d6fe1d1530550ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17eb73114b43f84c813ad176f8a8913fde8f175f0b41ecbe78bfd3bb20c30259aaab791cd9cb719c1aab9cef0daceed651d7c342201fffd227db495f5d55ce51
|
7
|
+
data.tar.gz: e42445092d3ab33eb27d1145c9897f94b3758bd57b624935fd8d8fd3f37999d3333caf70b2c713196a672978b478a8dc4a5923aa6924387331c076334e14391f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -18,28 +18,46 @@ jobs:
|
|
18
18
|
fail-fast: false
|
19
19
|
matrix:
|
20
20
|
ruby:
|
21
|
-
- '3.3
|
21
|
+
- '3.3'
|
22
22
|
- '3.2'
|
23
23
|
- '3.1'
|
24
24
|
- '3.0'
|
25
25
|
- '2.7'
|
26
26
|
include:
|
27
|
-
- ruby: '3.
|
27
|
+
- ruby: '3.3'
|
28
28
|
coverage: 'true'
|
29
29
|
steps:
|
30
30
|
- uses: actions/checkout@v4
|
31
|
+
|
31
32
|
- name: Install package dependencies
|
32
33
|
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
34
|
+
|
33
35
|
- name: Set up Ruby
|
34
36
|
uses: ruby/setup-ruby@v1
|
35
37
|
with:
|
36
38
|
ruby-version: ${{matrix.ruby}}
|
39
|
+
bundler: 'latest'
|
40
|
+
|
37
41
|
- name: Install latest bundler
|
38
42
|
run: |
|
39
|
-
|
43
|
+
if [[ "$(ruby -v | awk '{print $2}')" == 2.7.8* ]]; then
|
44
|
+
gem install bundler -v 2.4.22 --no-document
|
45
|
+
bundle config set version 2.4.22
|
46
|
+
gem update --system 3.4.22 --no-document
|
47
|
+
else
|
48
|
+
gem install bundler --no-document
|
49
|
+
gem update --system --no-document
|
50
|
+
fi
|
51
|
+
|
52
|
+
bundle config set without 'tools benchmarks docs'
|
53
|
+
|
40
54
|
- name: Bundle install
|
41
55
|
run: |
|
42
|
-
|
56
|
+
if [[ "$(ruby -v | awk '{print $2}')" == 2.7.8* ]]; then
|
57
|
+
BUNDLER_VERSION=2.4.22 bundle install --jobs 4 --retry 3
|
58
|
+
else
|
59
|
+
bundle install --jobs 4 --retry 3
|
60
|
+
fi
|
43
61
|
|
44
62
|
diffend:
|
45
63
|
runs-on: ubuntu-latest
|
@@ -49,14 +67,18 @@ jobs:
|
|
49
67
|
- uses: actions/checkout@v4
|
50
68
|
with:
|
51
69
|
fetch-depth: 0
|
70
|
+
|
52
71
|
- name: Set up Ruby
|
53
72
|
uses: ruby/setup-ruby@v1
|
54
73
|
with:
|
55
|
-
ruby-version: 3.
|
74
|
+
ruby-version: 3.3
|
75
|
+
|
56
76
|
- name: Install latest bundler
|
57
77
|
run: gem install bundler --no-document
|
78
|
+
|
58
79
|
- name: Install Diffend plugin
|
59
80
|
run: bundle plugin install diffend
|
81
|
+
|
60
82
|
- name: Bundle Secure
|
61
83
|
run: bundle secure
|
62
84
|
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Karafka Test gem changelog
|
2
2
|
|
3
|
+
## 2.3.1 (2024-03-07)
|
4
|
+
- [Enhancement] Prevent usage of testing when Karafka is not loaded.
|
5
|
+
- [Enhancement] Prevent usage of testing when Karafka is not initialized.
|
6
|
+
- [Fix] Same CG multiplexing topic builder fails with `TopicInManyConsumerGroupsError`.
|
7
|
+
|
8
|
+
## 2.3.0 (2024-01-26)
|
9
|
+
- [Maintenance] Release matching Karafka `2.3.0` release.
|
10
|
+
|
3
11
|
## 2.2.2 (2023-11-16)
|
4
12
|
- [**Feature**] Provide support for Minitest (ValentinoRusconi-EH)
|
5
13
|
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-testing (2.
|
5
|
-
karafka (>= 2.
|
6
|
-
waterdrop (>= 2.6.
|
4
|
+
karafka-testing (2.3.1)
|
5
|
+
karafka (>= 2.3.0, < 2.4.0)
|
6
|
+
waterdrop (>= 2.6.12)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
thor (>= 0.20)
|
16
|
-
waterdrop (>= 2.6.6, < 3.0.0)
|
11
|
+
ffi (1.16.3)
|
12
|
+
karafka (2.3.3)
|
13
|
+
karafka-core (>= 2.3.0, < 2.4.0)
|
14
|
+
waterdrop (>= 2.6.12, < 3.0.0)
|
17
15
|
zeitwerk (~> 2.3)
|
18
|
-
karafka-core (2.
|
19
|
-
|
20
|
-
|
21
|
-
karafka-rdkafka (0.13.3)
|
16
|
+
karafka-core (2.3.0)
|
17
|
+
karafka-rdkafka (>= 0.14.8, < 0.15.0)
|
18
|
+
karafka-rdkafka (0.14.10)
|
22
19
|
ffi (~> 1.15)
|
23
20
|
mini_portile2 (~> 2.6)
|
24
21
|
rake (> 12)
|
25
|
-
mini_portile2 (2.8.
|
26
|
-
rake (13.0
|
27
|
-
|
28
|
-
|
29
|
-
karafka-core (>= 2.1.1, < 3.0.0)
|
22
|
+
mini_portile2 (2.8.5)
|
23
|
+
rake (13.1.0)
|
24
|
+
waterdrop (2.6.14)
|
25
|
+
karafka-core (>= 2.2.3, < 3.0.0)
|
30
26
|
zeitwerk (~> 2.3)
|
31
|
-
zeitwerk (2.6.
|
27
|
+
zeitwerk (2.6.13)
|
32
28
|
|
33
29
|
PLATFORMS
|
34
|
-
|
30
|
+
ruby
|
35
31
|
x86_64-linux
|
36
32
|
|
37
33
|
DEPENDENCIES
|
38
34
|
karafka-testing!
|
39
35
|
|
40
36
|
BUNDLED WITH
|
41
|
-
2.
|
37
|
+
2.5.6
|
data/karafka-testing.gemspec
CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
|
25
25
|
end
|
26
26
|
|
27
|
-
spec.add_dependency 'karafka', '>= 2.
|
28
|
-
spec.add_dependency 'waterdrop', '>= 2.6.
|
27
|
+
spec.add_dependency 'karafka', '>= 2.3.0', '< 2.4.0'
|
28
|
+
spec.add_dependency 'waterdrop', '>= 2.6.12'
|
29
29
|
|
30
30
|
spec.metadata = {
|
31
31
|
'funding_uri' => 'https://karafka.io/#become-pro',
|
@@ -15,7 +15,17 @@ module Karafka
|
|
15
15
|
TopicInManyConsumerGroupsError = Class.new(BaseError)
|
16
16
|
|
17
17
|
# Raised when you requested a topic from a consumer group that does not exist
|
18
|
-
|
18
|
+
ConsumerGroupNotFoundError = Class.new(BaseError)
|
19
|
+
|
20
|
+
# Raised when trying to use testing without Karafka app being visible
|
21
|
+
# If you are seeing this error, then you tried to use testing helpers without Karafka being
|
22
|
+
# loaded prior to this happening.
|
23
|
+
KarafkaNotLoadedError = Class.new(BaseError)
|
24
|
+
|
25
|
+
# Raised when there is an attempt to use the testing primitives without Karafka app being
|
26
|
+
# configured. Prior to initialization process, most of config values are nils, etc and
|
27
|
+
# mocks will not work.
|
28
|
+
KarafkaNotInitializedError = Class.new(BaseError)
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
@@ -18,6 +18,8 @@ module Karafka
|
|
18
18
|
def included(base)
|
19
19
|
base.class_eval do
|
20
20
|
setup do
|
21
|
+
Karafka::Testing.ensure_karafka_initialized!
|
22
|
+
|
21
23
|
@karafka = Karafka::Testing::Minitest::Proxy.new(self)
|
22
24
|
@_karafka_consumer_messages = []
|
23
25
|
@_karafka_consumer_client = Karafka::Testing::SpecConsumerClient.new
|
@@ -176,6 +178,7 @@ module Karafka
|
|
176
178
|
rescue Karafka::Errors::TopicNotFoundError
|
177
179
|
nil
|
178
180
|
end
|
181
|
+
.uniq(&:consumer_group)
|
179
182
|
end
|
180
183
|
|
181
184
|
# Finds subscription groups from the requested consumer group or selects all if no
|
@@ -30,6 +30,8 @@ module Karafka
|
|
30
30
|
base.let(:_karafka_producer_client) { Karafka::Testing::SpecProducerClient.new(self) }
|
31
31
|
|
32
32
|
base.prepend_before do
|
33
|
+
Karafka::Testing.ensure_karafka_initialized!
|
34
|
+
|
33
35
|
_karafka_consumer_messages.clear
|
34
36
|
_karafka_producer_client.reset
|
35
37
|
|
@@ -194,6 +196,7 @@ module Karafka
|
|
194
196
|
rescue Karafka::Errors::TopicNotFoundError
|
195
197
|
nil
|
196
198
|
end
|
199
|
+
.uniq(&:consumer_group)
|
197
200
|
end
|
198
201
|
|
199
202
|
# Finds subscription groups from the requested consumer group or selects all if no
|
data/lib/karafka/testing.rb
CHANGED
@@ -4,5 +4,32 @@
|
|
4
4
|
module Karafka
|
5
5
|
# Testing lib module
|
6
6
|
module Testing
|
7
|
+
class << self
|
8
|
+
# Makes sure, that we do not use the testing stubs, etc when Karafka app is not loaded
|
9
|
+
#
|
10
|
+
# You should never use karafka-testing primitives when framework is not loaded because
|
11
|
+
# testing lib stubs certain pieces of Karafka that need to be initialized.
|
12
|
+
def ensure_karafka_loaded!
|
13
|
+
return if ::Karafka.const_defined?('App', false)
|
14
|
+
|
15
|
+
raise(
|
16
|
+
Karafka::Testing::Errors::KarafkaNotLoadedError,
|
17
|
+
'Make sure to load Karafka framework prior to usage of the testing components.'
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
# If you do not initialize Karafka always within your specs, do not include/use this lib
|
22
|
+
# in places where Karafka would not be loaded.
|
23
|
+
def ensure_karafka_initialized!
|
24
|
+
ensure_karafka_loaded!
|
25
|
+
|
26
|
+
return unless Karafka::App.initializing?
|
27
|
+
|
28
|
+
raise(
|
29
|
+
Karafka::Testing::Errors::KarafkaNotInitializedError,
|
30
|
+
'Make sure to initialize Karafka framework prior to usage of the testing components.'
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
7
34
|
end
|
8
35
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
36
36
|
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: karafka
|
@@ -43,34 +43,34 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.3.0
|
47
47
|
- - "<"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 2.4.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 2.
|
56
|
+
version: 2.3.0
|
57
57
|
- - "<"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 2.4.0
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: waterdrop
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 2.6.
|
66
|
+
version: 2.6.12
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 2.6.
|
73
|
+
version: 2.6.12
|
74
74
|
description: Library which provides helpers for easier Karafka consumers tests
|
75
75
|
email:
|
76
76
|
- contact@karafka.io
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.5.3
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Library which provides helpers for easier Karafka consumers tests
|
metadata.gz.sig
CHANGED
Binary file
|