karafka-testing 2.0.5 → 2.0.7
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +3 -3
- data/lib/karafka/testing/rspec/helpers.rb +11 -9
- data/lib/karafka/testing/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: def278737ad0002bf304bb3cd11147059afc0e922e43d3c6831571c0f0bb2c37
|
4
|
+
data.tar.gz: 1aa29aa83794776d0dfcf3b7f03abd1f4914c80d5301a71ea5c354bcc5671ee9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8570a7b1a25b32776f0d4887b77e9e6cd7bb47a5ec4f5345a7e52459dab3c6e3c87dd2df36896403686828f84edb44e630487e02535a83cc6705995ad06e1f4c
|
7
|
+
data.tar.gz: c549db8ad9cf987843b8fcc9a20fee37a736599dfb25c50057856a5aadcfe23c74cddd4ff57c7abe2d0acdb67b84badaf8a2ae964d2ad5a26abbad0f5d3f0fff
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Karafka Test gem changelog
|
2
2
|
|
3
|
+
## 2.0.7 (2022-11-03)
|
4
|
+
- Release version with cert with valid access permissions (#114).
|
5
|
+
|
6
|
+
## 2.0.6 (2022-10-26)
|
7
|
+
- Replace the `subject` reference with named `consumer` reference.
|
8
|
+
- Do not forward sent messages to `consumer` unless it's a Karafka consumer.
|
9
|
+
|
3
10
|
## 2.0.5 (2022-10-19)
|
4
11
|
- Fix for: Test event production without defining a subject (#102)
|
5
12
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-testing (2.0.
|
4
|
+
karafka-testing (2.0.7)
|
5
5
|
karafka (>= 2.0, < 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,7 +9,7 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
concurrent-ruby (1.1.10)
|
11
11
|
ffi (1.15.5)
|
12
|
-
karafka (2.0.
|
12
|
+
karafka (2.0.15)
|
13
13
|
karafka-core (>= 2.0.2, < 3.0.0)
|
14
14
|
rdkafka (>= 0.12)
|
15
15
|
thor (>= 0.20)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
karafka-core (>= 2.0.2, < 3.0.0)
|
29
29
|
rdkafka (>= 0.10)
|
30
30
|
zeitwerk (~> 2.3)
|
31
|
-
zeitwerk (2.6.
|
31
|
+
zeitwerk (2.6.4)
|
32
32
|
|
33
33
|
PLATFORMS
|
34
34
|
arm64-darwin
|
@@ -85,13 +85,15 @@ module Karafka
|
|
85
85
|
# karafka.produce({ 'hello' => 'world' }.to_json, 'partition' => 6)
|
86
86
|
# end
|
87
87
|
def _karafka_add_message_to_consumer_if_needed(message)
|
88
|
-
#
|
88
|
+
# Consumer needs to be defined in order to pass messages to it
|
89
|
+
return unless defined?(consumer)
|
90
|
+
# We're interested in adding message to consumer only when it is a Karafka consumer
|
89
91
|
# Users may want to test other things (models producing messages for example) and in
|
90
|
-
# their case
|
91
|
-
return unless
|
92
|
+
# their case consumer will not be a consumer
|
93
|
+
return unless consumer.is_a?(Karafka::BaseConsumer)
|
92
94
|
# We target to the consumer only messages that were produced to it, since specs may also
|
93
95
|
# produce other messages targeting other topics
|
94
|
-
return unless message[:topic] ==
|
96
|
+
return unless message[:topic] == consumer.topic.name
|
95
97
|
|
96
98
|
# Build message metadata and copy any metadata that would come from the message
|
97
99
|
metadata = _karafka_message_metadata_defaults
|
@@ -111,12 +113,12 @@ module Karafka
|
|
111
113
|
# Update batch metadata
|
112
114
|
batch_metadata = Karafka::Messages::Builders::BatchMetadata.call(
|
113
115
|
_karafka_consumer_messages,
|
114
|
-
|
116
|
+
consumer.topic,
|
115
117
|
Time.now
|
116
118
|
)
|
117
119
|
|
118
120
|
# Update consumer messages batch
|
119
|
-
|
121
|
+
consumer.messages = Karafka::Messages::Messages.new(
|
120
122
|
_karafka_consumer_messages,
|
121
123
|
batch_metadata
|
122
124
|
)
|
@@ -128,7 +130,7 @@ module Karafka
|
|
128
130
|
def _karafka_produce(payload, metadata = {})
|
129
131
|
Karafka.producer.produce_sync(
|
130
132
|
{
|
131
|
-
topic:
|
133
|
+
topic: consumer.topic.name,
|
132
134
|
payload: payload
|
133
135
|
}.merge(metadata)
|
134
136
|
)
|
@@ -144,14 +146,14 @@ module Karafka
|
|
144
146
|
# @return [Hash] message default options
|
145
147
|
def _karafka_message_metadata_defaults
|
146
148
|
{
|
147
|
-
deserializer:
|
149
|
+
deserializer: consumer.topic.deserializer,
|
148
150
|
timestamp: Time.now,
|
149
151
|
headers: {},
|
150
152
|
key: nil,
|
151
153
|
offset: _karafka_consumer_messages.size,
|
152
154
|
partition: 0,
|
153
155
|
received_at: Time.now,
|
154
|
-
topic:
|
156
|
+
topic: consumer.topic.name
|
155
157
|
}
|
156
158
|
end
|
157
159
|
|
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.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
|
36
36
|
MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: karafka
|
metadata.gz.sig
CHANGED
Binary file
|