logstash-devutils 2.2.0-java → 2.2.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/devutils/rake/publish.rake +1 -1
- data/lib/logstash/devutils/rspec/logstash_helpers.rb +28 -4
- data/logstash-devutils.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3032f571207f629539ec5d700a503822fcdc926f99cf85b3a591ec1917a80d
|
4
|
+
data.tar.gz: 5f8ba35dd80a02f8a329f74b28c18ec3d8100eab6fd50c71ac01061e8ff7df20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae858d1af44e21974fab7c43b8b90b8311e9e765493e67ecbfd4e6f0cbb3e39be8b647a16e083edfce109352115204f5ed92403c5b58edf3d5b6fcda92aa11f2
|
7
|
+
data.tar.gz: 0c70d08d421648b23f7004a2aa2eb7e6c1d3790a580ee0827eed44cad3b3417e4f56b232a496029e79bd9e6ea6684be60545121ad14f7c9b4b55e69d2d2ae52f
|
data/CHANGELOG.md
CHANGED
@@ -10,7 +10,7 @@ if RUBY_PLATFORM == "java"
|
|
10
10
|
cmd = Shellwords.join(arguments)
|
11
11
|
Open3.popen3(cmd) do |_i, stdout, stderr, thr|
|
12
12
|
output = [stderr.read, stdout.read].join.strip
|
13
|
-
raise Error,
|
13
|
+
raise Error, output if thr.value.exitstatus > 0
|
14
14
|
return output
|
15
15
|
end
|
16
16
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "logstash/agent"
|
2
2
|
require "logstash/event"
|
3
3
|
require "logstash/test_pipeline"
|
4
|
+
require "logstash/outputs/test_sink"
|
4
5
|
|
5
6
|
require "stud/try"
|
6
7
|
require "rspec/expectations"
|
@@ -52,11 +53,30 @@ module LogStashHelper
|
|
52
53
|
deprecated "tags(#{tags.inspect}) - let(:default_tags) are not used"
|
53
54
|
end
|
54
55
|
|
55
|
-
|
56
|
+
##
|
57
|
+
# Creates a single-example example group in the current rspec context to validate the results of filter operations.
|
58
|
+
# The current group is expected to use `LogStashHelpers#config` to provide a pipeline configuration.
|
59
|
+
#
|
60
|
+
# The provided block has access to an [Array] `results`, and also sets an unnamed `subject` that is either a
|
61
|
+
# single `LogStash::Event` or an `[Array[LogStash::Event]]` containing at least two entries.
|
62
|
+
#
|
63
|
+
# @param sample_event [String, #to_json]
|
64
|
+
# @param validation_source [:output, :queue]
|
65
|
+
# @yield creates an example with expectations provided by the block
|
66
|
+
# @return [void]
|
67
|
+
def sample(sample_event, validation_source: :output, &block)
|
68
|
+
validation_sources = [:output, :queue].freeze
|
69
|
+
fail(ArgumentError, "Unexpected source `#{validation_source.inspect}`, expected one of #{validation_sources.inspect}") unless validation_sources.include?(validation_source)
|
70
|
+
|
56
71
|
name = sample_event.is_a?(String) ? sample_event : LogStash::Json.dump(sample_event)
|
57
72
|
name = name[0..50] + "..." if name.length > 50
|
58
73
|
|
59
|
-
describe
|
74
|
+
describe name.inspect do
|
75
|
+
if validation_source == :output
|
76
|
+
let(:test_sink) { LogStash::Outputs::TestSink.new("release_on_close" => false, "store_events" => true) }
|
77
|
+
before { expect(LogStash::Outputs::TestSink).to receive(:new).and_return(test_sink) }
|
78
|
+
end
|
79
|
+
|
60
80
|
let(:pipeline) { new_pipeline_from_string(config) }
|
61
81
|
let(:event) do
|
62
82
|
sample_event = [sample_event] unless sample_event.is_a?(Array)
|
@@ -73,7 +93,11 @@ module LogStashHelper
|
|
73
93
|
# flush makes sure to empty any buffered events in the filter
|
74
94
|
pipeline.flush_filters(:final => true) { |flushed_event| results << flushed_event }
|
75
95
|
|
76
|
-
|
96
|
+
case validation_source
|
97
|
+
when :queue then pipeline.filter_queue_client.processed_events # legacy?
|
98
|
+
when :output then test_sink.event_store.to_a
|
99
|
+
else fail NotImplementedError("validation source `#{validation_source}` not implemented.")
|
100
|
+
end
|
77
101
|
end
|
78
102
|
|
79
103
|
# starting at logstash-core 5.3 an initialized pipeline need to be closed
|
@@ -83,7 +107,7 @@ module LogStashHelper
|
|
83
107
|
|
84
108
|
subject { results.length > 1 ? results : results.first }
|
85
109
|
|
86
|
-
it("
|
110
|
+
it("processes events as specified", &block)
|
87
111
|
end
|
88
112
|
end # def sample
|
89
113
|
|
data/logstash-devutils.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-devutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.6.13
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: An assortment of tooling/libraries to make Logstash plugin development and
|