karafka-testing 1.4.0 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0298e37f23636bffa1ff1d652539060a6847e0bf7425da023a54c6805aa157f6'
4
- data.tar.gz: 14d526794e88e6514670a66b4357422fc826d6c7aca70e8ec5a2ca3a70d3c134
3
+ metadata.gz: e7b549f6c7bc5b183d42d1f8c0a6cb91a7775be1afedb97b7ab67b9572de0f11
4
+ data.tar.gz: 05e90f300b60e2a43fc144b1c7b40b6491fcce99045c89738d639f2f88c8cb34
5
5
  SHA512:
6
- metadata.gz: 9176308309e664d1cb7a1dd0769c233d8d8631850b3005026b044423f8f2642aac7e596727e4b30d7562711ce7a24db0c6cbb6c4e6089ce1619d39a1104fc66b
7
- data.tar.gz: be8a892da240be42bfd317e9662cbb86aedb8750d4fa44da8108495ee738f1339ad6f533f3e194cb536e081c095886ccd54711042b445318789d9d014b42d470
6
+ metadata.gz: 6eaee75502f6c322dab1d26fed626d2f9ca72b539d217f8fa83669787de1d11e3e911d4e826296d14b2a66525a10d5f35f2f63ae61b64b4034c8665234e2ed83
7
+ data.tar.gz: b3e8f32748ff781132b9a115b7a2466122c677c2321f988b653957804dd3501b159dbb9ca866e515e92edecc0050b15fc180e2e75c2fee7cd93db4672160f91c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,6 +1,9 @@
1
1
  name: ci
2
2
 
3
+ concurrency: ci-${{ github.ref }}
4
+
3
5
  on:
6
+ pull_request:
4
7
  push:
5
8
  schedule:
6
9
  - cron: '0 1 * * *'
@@ -8,15 +11,16 @@ on:
8
11
  jobs:
9
12
  specs:
10
13
  runs-on: ubuntu-latest
14
+ needs: diffend
11
15
  strategy:
12
16
  fail-fast: false
13
17
  matrix:
14
18
  ruby:
19
+ - '3.1'
20
+ - '3.0'
15
21
  - '2.7'
16
- - '2.6'
17
- - '2.5'
18
22
  include:
19
- - ruby: '2.7'
23
+ - ruby: '3.1'
20
24
  coverage: 'true'
21
25
  steps:
22
26
  - uses: actions/checkout@v2
@@ -32,6 +36,26 @@ jobs:
32
36
  - name: Bundle install
33
37
  run: |
34
38
  bundle install --jobs 4 --retry 3
39
+
40
+ diffend:
41
+ runs-on: ubuntu-latest
42
+ strategy:
43
+ fail-fast: false
44
+ steps:
45
+ - uses: actions/checkout@v2
46
+ with:
47
+ fetch-depth: 0
48
+ - name: Set up Ruby
49
+ uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: 3.1
52
+ - name: Install latest bundler
53
+ run: gem install bundler --no-document
54
+ - name: Install Diffend plugin
55
+ run: bundle plugin install diffend
56
+ - name: Bundle Secure
57
+ run: bundle secure
58
+
35
59
  coditsu:
36
60
  runs-on: ubuntu-latest
37
61
  strategy:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.1
1
+ 3.1.2
data/2.0-Upgrade.md ADDED
@@ -0,0 +1,60 @@
1
+ # Welcome to Karafka-Testing 2.0!
2
+
3
+ Karafka-Testing 2.0 some breaking changes in the way consumer builder and message publishing is done.
4
+
5
+ ## Upgrade
6
+
7
+ Please upgrade your application to `Karafka 2.0` first.
8
+
9
+ - Replace `#karafka_consumer_for` in your specs with `#karafka.consumer_for`
10
+ - Replace `#publish_for_karafka` in your specs with `#karafka.publish`
11
+
12
+ And that's all!
13
+
14
+ Below you can find same example written for Karafka `2.0` and `1.4`.
15
+
16
+ ### Karafka 2.0
17
+
18
+ ```ruby
19
+ RSpec.describe CountersConsumer do
20
+ subject(:consumer) { karafka.consumer_for(:counters) }
21
+
22
+ let(:nr1_value) { rand }
23
+ let(:nr2_value) { rand }
24
+ let(:sum) { nr1_value + nr2_value }
25
+
26
+ before do
27
+ karafka.publish({ 'number' => nr1_value }.to_json)
28
+ karafka.publish({ 'number' => nr2_value }.to_json, partition: 2)
29
+ allow(Karafka.logger).to receive(:info)
30
+ end
31
+
32
+ it 'expects to log a proper message' do
33
+ expect(Karafka.logger).to receive(:info).with("Sum of 2 elements equals to: #{sum}")
34
+ consumer.consume
35
+ end
36
+ end
37
+ ```
38
+
39
+ ### Karafka 1.4
40
+
41
+ ```ruby
42
+ RSpec.describe InlineBatchConsumer do
43
+ subject(:consumer) { karafka_consumer_for(:counters) }
44
+
45
+ let(:nr1_value) { rand }
46
+ let(:nr2_value) { rand }
47
+ let(:sum) { nr1_value + nr2_value }
48
+
49
+ before do
50
+ publish_for_karafka({ 'number' => nr1_value }.to_json)
51
+ publish_for_karafka({ 'number' => nr2_value }.to_json, partition: 2)
52
+ allow(Karafka.logger).to receive(:info)
53
+ end
54
+
55
+ it 'expects to log a proper message' do
56
+ expect(Karafka.logger).to receive(:info).with("Sum of 2 elements equals to: #{sum}")
57
+ consumer.consume
58
+ end
59
+ end
60
+ ```
data/CHANGELOG.md CHANGED
@@ -1,17 +1,26 @@
1
1
  # Karafka Test gem changelog
2
2
 
3
- ## 1.4.0 (2020-09-05)
4
- - Update to match Karafka 1.4.0 params and batch metadata setup
3
+ ## 2.0.0 (2022-08-01)
4
+ - No changes. Just non-rc release.
5
5
 
6
- ## 1.3.1 (2020-04-24)
7
- - change license to LGPL-3.0
8
- - Ruby 2.6.5 support
9
- - Ruby 2.7.1 support
10
- - JRuby support
11
- - Change license to LGPL-3.0
6
+ ## 2.0.0.rc1 (2022-07-19)
7
+ - Require Karafka `2.0.0.rc2`
12
8
 
13
- ## 1.3.0 (2019-09-09)
14
- - Dynamic `App` name (#2)
9
+ ## 2.0.0.alpha4 (2022-07-06)
10
+ - Require Karafka `2.0.0.beta5` and fix non-existing coordinator reference
15
11
 
16
- ## 1.3.0.rc1 (2019-07-31)
17
- - Support for Karafka 1.3
12
+ ## 2.0.0.alpha3 (2022-03-14)
13
+ - Provide support for referencing producer from consumer
14
+
15
+ ## 2.0.0.alpha2 (2022-02-19)
16
+ - Add `rubygems_mfa_required`
17
+
18
+ ## 2.0.0.alpha1 (2022-01-30)
19
+ - Change the API to be more comprehensive
20
+ - Update to work with Karafka 2.0
21
+ - Support for Ruby 3.1
22
+ - Drop support for ruby 2.6
23
+
24
+ ## 1.4.*
25
+
26
+ If you are looking for the changelog of `1.4`, please go [here](https://github.com/karafka/testing/blob/1.4/CHANGELOG.md).
data/Gemfile.lock CHANGED
@@ -1,103 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-testing (1.4.0)
5
- karafka (~> 1.4.0.rc2)
4
+ karafka-testing (2.0.0)
5
+ karafka (>= 2.0.rc4, < 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- concurrent-ruby (1.1.7)
11
- delivery_boy (1.0.1)
12
- king_konf (~> 0.3)
13
- ruby-kafka (~> 1.0)
14
- digest-crc (0.6.1)
15
- rake (~> 13.0)
16
- dry-configurable (0.11.6)
17
- concurrent-ruby (~> 1.0)
18
- dry-core (~> 0.4, >= 0.4.7)
19
- dry-equalizer (~> 0.2)
20
- dry-container (0.7.2)
21
- concurrent-ruby (~> 1.0)
22
- dry-configurable (~> 0.1, >= 0.1.3)
23
- dry-core (0.4.9)
24
- concurrent-ruby (~> 1.0)
25
- dry-equalizer (0.3.0)
26
- dry-events (0.2.0)
27
- concurrent-ruby (~> 1.0)
28
- dry-core (~> 0.4)
29
- dry-equalizer (~> 0.2)
30
- dry-inflector (0.2.0)
31
- dry-initializer (3.0.3)
32
- dry-logic (1.0.7)
33
- concurrent-ruby (~> 1.0)
34
- dry-core (~> 0.2)
35
- dry-equalizer (~> 0.2)
36
- dry-monitor (0.3.2)
37
- dry-configurable (~> 0.5)
38
- dry-core (~> 0.4)
39
- dry-equalizer (~> 0.2)
40
- dry-events (~> 0.2)
41
- dry-schema (1.5.4)
42
- concurrent-ruby (~> 1.0)
43
- dry-configurable (~> 0.8, >= 0.8.3)
44
- dry-core (~> 0.4)
45
- dry-equalizer (~> 0.2)
46
- dry-initializer (~> 3.0)
47
- dry-logic (~> 1.0)
48
- dry-types (~> 1.4)
49
- dry-types (1.4.0)
50
- concurrent-ruby (~> 1.0)
51
- dry-container (~> 0.3)
52
- dry-core (~> 0.4, >= 0.4.4)
53
- dry-equalizer (~> 0.3)
54
- dry-inflector (~> 0.1, >= 0.1.2)
55
- dry-logic (~> 1.0, >= 1.0.2)
56
- dry-validation (1.5.6)
57
- concurrent-ruby (~> 1.0)
58
- dry-container (~> 0.7, >= 0.7.1)
59
- dry-core (~> 0.4)
60
- dry-equalizer (~> 0.2)
61
- dry-initializer (~> 3.0)
62
- dry-schema (~> 1.5, >= 1.5.2)
63
- envlogic (1.1.2)
64
- dry-inflector (~> 0.1)
65
- io-console (0.5.6)
66
- irb (1.2.4)
67
- reline (>= 0.0.1)
68
- karafka (1.4.0.rc2)
69
- dry-configurable (~> 0.8)
70
- dry-inflector (~> 0.1)
71
- dry-monitor (~> 0.3)
72
- dry-validation (~> 1.2)
73
- envlogic (~> 1.1)
74
- irb (~> 1.0)
75
- rake (>= 11.3)
76
- ruby-kafka (>= 1.0.0)
10
+ concurrent-ruby (1.1.10)
11
+ ffi (1.15.5)
12
+ karafka (2.0.0.rc4)
13
+ karafka-core (>= 2.0.0, < 3.0.0)
14
+ rdkafka (>= 0.10)
77
15
  thor (>= 0.20)
78
- waterdrop (~> 1.4.0)
79
- zeitwerk (~> 2.1)
80
- king_konf (0.3.7)
81
- rake (13.0.1)
82
- reline (0.1.4)
83
- io-console (~> 0.5)
84
- ruby-kafka (1.2.0)
85
- digest-crc
86
- thor (1.0.1)
87
- waterdrop (1.4.0)
88
- delivery_boy (>= 0.2, < 2.x)
89
- dry-configurable (~> 0.8)
90
- dry-monitor (~> 0.3)
91
- dry-validation (~> 1.2)
92
- ruby-kafka (>= 0.7.8)
93
- zeitwerk (~> 2.1)
94
- zeitwerk (2.4.0)
16
+ waterdrop (>= 2.4.0, < 3.0.0)
17
+ zeitwerk (~> 2.3)
18
+ karafka-core (2.0.2)
19
+ concurrent-ruby (>= 1.1)
20
+ mini_portile2 (2.8.0)
21
+ rake (13.0.6)
22
+ rdkafka (0.12.0)
23
+ ffi (~> 1.15)
24
+ mini_portile2 (~> 2.6)
25
+ rake (> 12)
26
+ thor (1.2.1)
27
+ waterdrop (2.4.1)
28
+ karafka-core (>= 2.0.2, < 3.0.0)
29
+ rdkafka (>= 0.10)
30
+ zeitwerk (~> 2.3)
31
+ zeitwerk (2.6.0)
95
32
 
96
33
  PLATFORMS
97
- ruby
34
+ x86_64-linux
98
35
 
99
36
  DEPENDENCIES
100
37
  karafka-testing!
101
38
 
102
39
  BUNDLED WITH
103
- 2.1.4
40
+ 2.3.15
data/MIT-LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining
2
+ a copy of this software and associated documentation files (the
3
+ "Software"), to deal in the Software without restriction, including
4
+ without limitation the rights to use, copy, modify, merge, publish,
5
+ distribute, sublicense, and/or sell copies of the Software, and to
6
+ permit persons to whom the Software is furnished to do so, subject to
7
+ the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # Karafka Testing library
2
2
 
3
- [![Build Status](https://github.com/karafka/testing/workflows/ci/badge.svg)](https://github.com/karafka/testing/actions?query=workflow%3Aci)
4
- [![Join the chat at https://gitter.im/karafka/karafka](https://badges.gitter.im/karafka/karafka.svg)](https://gitter.im/karafka/karafka?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+ **Note**: Documentation presented below works with Karafka `2.0.0.alpha3` and higher.
5
4
 
6
- Karafka-Testing is a library that provides rspec helpers, to make testing of Karafka consumers much easier.
5
+ Please refer to [this](https://github.com/karafka/testing/tree/1.4) branch and its documentation for details about usage with Karafka `1.4`.
6
+
7
+ [![Build Status](https://github.com/karafka/karafka-testing/workflows/ci/badge.svg)](https://github.com/karafka/karafka-testing/actions?query=workflow%3Aci)
8
+ [![Gem Version](https://badge.fury.io/rb/karafka-testing.svg)](http://badge.fury.io/rb/karafka-testing)
9
+ [![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)
10
+
11
+ Karafka-Testing is a library that provides RSpec helpers, to make testing of Karafka consumers much easier.
7
12
 
8
13
  ## Installation
9
14
 
@@ -27,18 +32,17 @@ end
27
32
 
28
33
  ## Usage
29
34
 
30
- Once included into your RSpec setup, this library will provide you two methods that you can use with your specs:
31
-
32
- - `#karafka_consumer_for` - this method will create a consumer instance for the desired topic. It **needs** to be set as the spec subject.
33
- - `#publish_for_karafka` - this method will "send" message to the consumer instance.
35
+ Once included into your RSpec setup, this library will provide you with a special object `#karafka` that includes two methods that you can use with your specs:
34
36
 
37
+ - `#consumer_for` - creates a consumer instance for the desired topic. It **needs** to be set as the spec subject.
38
+ - `#publish` - "sends" message to the consumer instance.
35
39
 
36
- **Note:** Messages sent using the `#publish_for_karafka` method won't be sent to Kafka. They will be "virtually" delegated to the created consumer instance so your specs can run without Kafka setup.
40
+ **Note:** Messages sent using the `#publish` method won't be sent to Kafka. They will be "virtually" delegated to the created consumer instance so your specs can run without Kafka setup.
37
41
 
38
42
  ```ruby
39
43
  RSpec.describe InlineBatchConsumer do
40
44
  # This will create a consumer instance with all the settings defined for the given topic
41
- subject(:consumer) { karafka_consumer_for(:inline_batch_data) }
45
+ subject(:consumer) { karafka.consumer_for(:inline_batch_data) }
42
46
 
43
47
  let(:nr1_value) { rand }
44
48
  let(:nr2_value) { rand }
@@ -46,9 +50,9 @@ RSpec.describe InlineBatchConsumer do
46
50
 
47
51
  before do
48
52
  # Sends first message to Karafka consumer
49
- publish_for_karafka({ 'number' => nr1_value }.to_json)
53
+ karafka.publish({ 'number' => nr1_value }.to_json)
50
54
  # Sends second message to Karafka consumer
51
- publish_for_karafka({ 'number' => nr2_value }.to_json)
55
+ karafka.publish({ 'number' => nr2_value }.to_json, partition: 2)
52
56
  allow(Karafka.logger).to receive(:info)
53
57
  end
54
58
 
@@ -59,20 +63,28 @@ RSpec.describe InlineBatchConsumer do
59
63
  end
60
64
  ```
61
65
 
62
- ## References
66
+ If your consumers use `producer` to dispatch messages, you can set up your expectations against it as well:
63
67
 
64
- * [Karafka framework](https://github.com/karafka/karafka)
65
- * [Karafka Testing Actions CI](https://github.com/karafka/testing/actions?query=workflow%3Aci)
66
- * [Karafka Testing Coditsu](https://app.coditsu.io/karafka/repositories/testing)
68
+ ```ruby
69
+ RSpec.describe InlineBatchConsumer do
70
+ subject(:consumer) { karafka.consumer_for(:inline_batch_data) }
67
71
 
68
- ## Note on contributions
72
+ before { karafka.publish({ 'number' => 1 }.to_json) }
69
73
 
70
- First, thank you for considering contributing to Karafka Testing! It's people like you that make the open source community such a great community!
74
+ it 'expects to dispatch async message to messages topic with value bigger by 1' do
75
+ expect(consumer.producer)
76
+ .to receive(:produce_async)
77
+ .with(topic: 'messages', payload: { number: 2 }.to_json)
71
78
 
72
- Each pull request must pass all the RSpec specs and meet our quality requirements.
79
+ consumer.consume
80
+ end
81
+ end
82
+ ```
83
+
84
+ ## Note on contributions
73
85
 
74
- To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combines multiple linters and code analyzers for both code and documentation. Once you're done with your changes, submit a pull request.
86
+ First, thank you for considering contributing to the Karafka ecosystem! It's people like you that make the open source community such a great community!
75
87
 
76
- Coditsu will automatically check your work against our quality standards. You can find your commit check results on the [builds page](https://app.coditsu.io/karafka/repositories/test/builds/commit_builds) of the Karafka Testing repository.
88
+ Each pull request must pass all the RSpec specs, integration tests and meet our quality requirements.
77
89
 
78
- [![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://app.coditsu.io/karafka/repositories/testing/builds/commit_builds)
90
+ Fork it, update and wait for the Github Actions results.
data/certs/mensfeld.pem CHANGED
@@ -1,25 +1,25 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
3
- ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjAwODExMDkxNTM3WhcNMjEwODExMDkx
4
- NTM3WjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
5
- CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDCpXsCgmINb6lHBXXBdyrgsBPSxC4/
6
- 2H+weJ6L9CruTiv2+2/ZkQGtnLcDgrD14rdLIHK7t0o3EKYlDT5GhD/XUVhI15JE
7
- N7IqnPUgexe1fbZArwQ51afxz2AmPQN2BkB2oeQHXxnSWUGMhvcEZpfbxCCJH26w
8
- hS0Ccsma8yxA6hSlGVhFVDuCr7c2L1di6cK2CtIDpfDaWqnVNJEwBYHIxrCoWK5g
9
- sIGekVt/admS9gRhIMaIBg+Mshth5/DEyWO2QjteTodItlxfTctrfmiAl8X8T5JP
10
- VXeLp5SSOJ5JXE80nShMJp3RFnGw5fqjX/ffjtISYh78/By4xF3a25HdWH9+qO2Z
11
- tx0wSGc9/4gqNM0APQnjN/4YXrGZ4IeSjtE+OrrX07l0TiyikzSLFOkZCAp8oBJi
12
- Fhlosz8xQDJf7mhNxOaZziqASzp/hJTU/tuDKl5+ql2icnMv5iV/i6SlmvU29QNg
13
- LCV71pUv0pWzN+OZbHZK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e7ZzPzXj
24
+ pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
25
25
  -----END CERTIFICATE-----
@@ -13,18 +13,23 @@ Gem::Specification.new do |spec|
13
13
  spec.email = %w[maciej@mensfeld.pl]
14
14
  spec.summary = 'Library which provides helpers for easier Karafka consumers tests'
15
15
  spec.description = 'Library which provides helpers for easier Karafka consumers tests'
16
- spec.homepage = 'https://github.com/karafka/testing'
17
- spec.license = 'LGPL-3.0'
16
+ spec.homepage = 'https://karafka.io'
17
+ spec.license = 'MIT'
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.require_paths = %w[lib]
21
21
  spec.cert_chain = %w[certs/mensfeld.pem]
22
22
 
23
- spec.required_ruby_version = '>= 2.5.0'
23
+ spec.required_ruby_version = '>= 2.7'
24
24
 
25
25
  if $PROGRAM_NAME.end_with?('gem')
26
26
  spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
27
27
  end
28
28
 
29
- spec.add_dependency 'karafka', '~> 1.4.0.rc2'
29
+ spec.add_dependency 'karafka', '>= 2.0.rc4', '< 3.0.0'
30
+
31
+ spec.metadata = {
32
+ 'source_code_uri' => 'https://github.com/karafka/karafka',
33
+ 'rubygems_mfa_required' => 'true'
34
+ }
30
35
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ module Testing
5
+ # A dummy client that takes over client delegated methods from the consumers
6
+ # For specs we do not mark anything as consumed, nor do we really send heartbeats.
7
+ # Those things are tested in the framework itself
8
+ class DummyClient
9
+ %i[
10
+ mark_as_consumed
11
+ mark_as_consumed!
12
+ ].each do |caught_delegator|
13
+ define_method(caught_delegator) { |*| }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'karafka/testing/errors'
4
+ require 'karafka/testing/dummy_client'
5
+ require 'karafka/testing/rspec/proxy'
4
6
 
5
7
  module Karafka
6
8
  module Testing
@@ -15,14 +17,15 @@ module Karafka
15
17
  def included(base)
16
18
  # This is an internal buffer for keeping "to be sent" messages before
17
19
  # we run the consume
18
- base.let(:_karafka_raw_data) { [] }
19
- # Clear the messages buffer after each spec, so nothing will leak
20
- # in between them
21
- base.after { _karafka_raw_data.clear }
20
+ base.let(:_karafka_messages) { [] }
21
+ base.let(:karafka) { Karafka::Testing::RSpec::Proxy.new(self) }
22
+ # Clear the messages buffer after each spec, so nothing leaks in between them
23
+ base.after { _karafka_messages.clear }
22
24
  end
23
25
  end
24
26
 
25
- # Creates a consumer instance for given topic
27
+ # Creates a consumer instance for a given topic
28
+ #
26
29
  # @param requested_topic [String, Symbol] name of the topic for which we want to
27
30
  # create a consumer instance
28
31
  # @return [Object] described_class instance
@@ -31,12 +34,12 @@ module Karafka
31
34
  #
32
35
  # @example Creates a MyConsumer consumer instance with settings for `my_requested_topic`
33
36
  # RSpec.describe MyConsumer do
34
- # subject(:consumer) { karafka_consumer_for(:my_requested_topic) }
37
+ # subject(:consumer) { karafka.consumer_for(:my_requested_topic) }
35
38
  # end
36
39
  def karafka_consumer_for(requested_topic)
37
40
  selected_topic = nil
38
41
 
39
- # @note Remove in 2.0. This won't work without the global state
42
+ # @note Remove in 2.1. This won't work without the global state
40
43
  ::Karafka::App.consumer_groups.each do |consumer_group|
41
44
  consumer_group.topics.each do |topic|
42
45
  selected_topic = topic if topic.name == requested_topic.to_s
@@ -45,48 +48,64 @@ module Karafka
45
48
 
46
49
  raise Karafka::Testing::Errors::TopicNotFoundError, requested_topic unless selected_topic
47
50
 
48
- described_class.new(selected_topic)
51
+ coordinators = Karafka::Processing::CoordinatorsBuffer.new
52
+
53
+ consumer = described_class.new
54
+ consumer.topic = selected_topic
55
+ consumer.producer = Karafka::App.producer
56
+ consumer.client = Karafka::Testing::DummyClient.new
57
+ consumer.coordinator = coordinators.find_or_create(requested_topic, 0)
58
+ consumer
49
59
  end
50
60
 
51
- # Adds a new Karafka params instance with given payload and options into an internal
61
+ # Adds a new Karafka message instance with given payload and options into an internal
52
62
  # buffer that will be used to simulate messages delivery to the consumer
53
63
  #
54
- # @param raw_payload [String] anything you want to send
64
+ # @param payload [String] anything you want to send
55
65
  # @param opts [Hash] additional options with which you want to overwrite the
56
66
  # message defaults (key, offset, etc)
57
67
  #
58
68
  # @example Send a json message to consumer
59
69
  # before do
60
- # publish_for_karafka({ 'hello' => 'world' }.to_json)
70
+ # karafka.publish({ 'hello' => 'world' }.to_json)
61
71
  # end
62
72
  #
63
73
  # @example Send a json message to consumer and simulate, that it is partition 6
64
74
  # before do
65
- # publish_for_karafka({ 'hello' => 'world' }.to_json, 'partition' => 6)
75
+ # karafka.publish({ 'hello' => 'world' }.to_json, 'partition' => 6)
66
76
  # end
67
- def publish_for_karafka(raw_payload, opts = {})
68
- metadata = Karafka::Params::Metadata.new(
69
- **metadata_defaults.merge(opts)
77
+ def karafka_publish(payload, opts = {})
78
+ metadata = Karafka::Messages::Metadata.new(
79
+ **karafka_message_metadata_defaults.merge(opts)
70
80
  ).freeze
71
81
 
72
- _karafka_raw_data << Karafka::Params::Params.new(raw_payload, metadata)
73
- subject.params_batch = Karafka::Params::ParamsBatch.new(_karafka_raw_data)
82
+ # Add this message to previously published messages
83
+ _karafka_messages << Karafka::Messages::Message.new(payload, metadata)
84
+
85
+ # Update batch metadata
86
+ batch_metadata = Karafka::Messages::Builders::BatchMetadata.call(
87
+ _karafka_messages,
88
+ subject.topic,
89
+ Time.now
90
+ )
91
+
92
+ # Update consumer messages batch
93
+ subject.messages = Karafka::Messages::Messages.new(_karafka_messages, batch_metadata)
74
94
  end
75
95
 
76
96
  private
77
97
 
78
98
  # @return [Hash] message default options
79
- def metadata_defaults
99
+ def karafka_message_metadata_defaults
80
100
  {
81
- 'deserializer' => subject.topic.deserializer,
82
- 'create_time' => Time.now,
83
- 'headers' => {},
84
- 'is_control_record' => false,
85
- 'key' => nil,
86
- 'offset' => 0,
87
- 'partition' => 0,
88
- 'receive_time' => Time.now,
89
- 'topic' => subject.topic.name
101
+ deserializer: subject.topic.deserializer,
102
+ timestamp: Time.now,
103
+ headers: {},
104
+ key: nil,
105
+ offset: _karafka_messages.size,
106
+ partition: 0,
107
+ received_at: Time.now,
108
+ topic: subject.topic.name
90
109
  }
91
110
  end
92
111
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ module Testing
5
+ module RSpec
6
+ # Proxy object for a nicer `karafka.` API within RSpec
7
+ class Proxy
8
+ # @param rspec_example [RSpec::ExampleGroups] rspec context
9
+ def initialize(rspec_example)
10
+ @rspec_example = rspec_example
11
+ end
12
+
13
+ # @param args Anything that the `#karafka_consumer_for` accepts
14
+ def consumer_for(*args)
15
+ @rspec_example.karafka_consumer_for(*args)
16
+ end
17
+
18
+ # @param args Anything that the `#karafka_publish` accepts
19
+ def publish(*args)
20
+ @rspec_example.karafka_publish(*args)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -4,6 +4,6 @@
4
4
  module Karafka
5
5
  module Testing
6
6
  # Current version of gem. It should match Karafka framework version
7
- VERSION = '1.4.0'
7
+ VERSION = '2.0.0'
8
8
  end
9
9
  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: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -11,45 +11,51 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
14
- ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjAwODExMDkxNTM3WhcNMjEwODExMDkx
15
- NTM3WjAjM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eytpln7K+M1u2g1pHVEPW4owD/ammXNpUy
35
- nt70FcDD4yxJQ+0YNiHd0N8IcVBM1TMIVctMNQ==
27
+ c2ZlbGQucGwwDQYJKoZIhvcNAQELBQADggGBADD0/UuTTFgW+CGk2U0RDw2RBOca
28
+ W2LTF/G7AOzuzD0Tc4voc7WXyrgKwJREv8rgBimLnNlgmFJLmtUCh2U/MgxvcilH
29
+ yshYcbseNvjkrtYnLRlWZR4SSB6Zei5AlyGVQLPkvdsBpNegcG6w075YEwzX/38a
30
+ 8V9B/Yri2OGELBz8ykl7BsXUgNoUPA/4pHF6YRLz+VirOaUIQ4JfY7xGj6fSOWWz
31
+ /rQ/d77r6o1mfJYM/3BRVg73a3b7DmRnE5qjwmSaSQ7u802pJnLesmArch0xGCT/
32
+ fMmRli1Qb+6qOTl9mzD6UDMAyFR4t6MStLm0mIEqM0nBO5nUdUWbC7l9qXEf8XBE
33
+ 2DP28p3EqSuS+lKbAWKcqv7t0iRhhmaod+Yn9mcrLN1sa3q3KSQ9BCyxezCD4Mk2
34
+ R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
35
+ pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
36
36
  -----END CERTIFICATE-----
37
- date: 2020-09-05 00:00:00.000000000 Z
37
+ date: 2022-08-01 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: karafka
41
41
  requirement: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - "~>"
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.4.0.rc2
45
+ version: 2.0.rc4
46
+ - - "<"
47
+ - !ruby/object:Gem::Version
48
+ version: 3.0.0
46
49
  type: :runtime
47
50
  prerelease: false
48
51
  version_requirements: !ruby/object:Gem::Requirement
49
52
  requirements:
50
- - - "~>"
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.0.rc4
56
+ - - "<"
51
57
  - !ruby/object:Gem::Version
52
- version: 1.4.0.rc2
58
+ version: 3.0.0
53
59
  description: Library which provides helpers for easier Karafka consumers tests
54
60
  email:
55
61
  - maciej@mensfeld.pl
@@ -59,28 +65,32 @@ extra_rdoc_files: []
59
65
  files:
60
66
  - ".coditsu/ci.yml"
61
67
  - ".diffend.yml"
62
- - ".github/FUNDING.yml"
63
68
  - ".github/workflows/ci.yml"
64
69
  - ".gitignore"
65
70
  - ".rspec"
66
71
  - ".ruby-gemset"
67
72
  - ".ruby-version"
73
+ - 2.0-Upgrade.md
68
74
  - CHANGELOG.md
69
75
  - Gemfile
70
76
  - Gemfile.lock
71
- - LICENSE
77
+ - MIT-LICENSE
72
78
  - README.md
73
79
  - certs/mensfeld.pem
74
80
  - karafka-testing.gemspec
75
81
  - lib/karafka-testing.rb
76
82
  - lib/karafka/testing.rb
83
+ - lib/karafka/testing/dummy_client.rb
77
84
  - lib/karafka/testing/errors.rb
78
85
  - lib/karafka/testing/rspec/helpers.rb
86
+ - lib/karafka/testing/rspec/proxy.rb
79
87
  - lib/karafka/testing/version.rb
80
- homepage: https://github.com/karafka/testing
88
+ homepage: https://karafka.io
81
89
  licenses:
82
- - LGPL-3.0
83
- metadata: {}
90
+ - MIT
91
+ metadata:
92
+ source_code_uri: https://github.com/karafka/karafka
93
+ rubygems_mfa_required: 'true'
84
94
  post_install_message:
85
95
  rdoc_options: []
86
96
  require_paths:
@@ -89,14 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
99
  requirements:
90
100
  - - ">="
91
101
  - !ruby/object:Gem::Version
92
- version: 2.5.0
102
+ version: '2.7'
93
103
  required_rubygems_version: !ruby/object:Gem::Requirement
94
104
  requirements:
95
105
  - - ">="
96
106
  - !ruby/object:Gem::Version
97
107
  version: '0'
98
108
  requirements: []
99
- rubygems_version: 3.1.4
109
+ rubygems_version: 3.3.7
100
110
  signing_key:
101
111
  specification_version: 4
102
112
  summary: Library which provides helpers for easier Karafka consumers tests
metadata.gz.sig CHANGED
Binary file
data/.github/FUNDING.yml DELETED
@@ -1 +0,0 @@
1
- open_collective: karafka
data/LICENSE DELETED
@@ -1,165 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.