logstash-codec-gzip_lines 3.0.3 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '078e37f6d953996943a59209406519d4409632e5888d347915cb7cd8d11f9f49'
4
- data.tar.gz: daec1c98eb056cc95c304b6f96c4a9cd264792b81a00cb911af93ecb0883dbba
3
+ metadata.gz: 5a8d6e1df05470e50b267a05a2c84af5b87a233604d459e9eeadd1812951fcaa
4
+ data.tar.gz: 36716ee63274ba9a68ff940ac9636a0fc67b1c2996007d2fb1cce4e33c1d92e9
5
5
  SHA512:
6
- metadata.gz: cc4e36c0494800f96f7dff431821ceebc8befd56724c55c9648be5cff3211d0ac6eeace84dc929e63ba30fc84b374bc0177ec7a67e076704f9bce3e5021fa883
7
- data.tar.gz: 6bc5262297874c5312016a7a74c4ce944474762076d8fce5395cd772d656089e833179b82cd42bf6e3f2f59ffe56511c96ba5d72a15f9ba0a7776094b1370702
6
+ metadata.gz: 543609bdb2fc35724003150cf79223a42051857e8ffd74be421b57df04c1dc5532448faa06b9e58c6b79dec7066cc8babe80928771696a192ddc57045907fcd9
7
+ data.tar.gz: 396c1d8e258291c621cff2af6c9f4f5d584ed1acf5531571aeebc48c070c2d81e8837e786abfd6df0dee2973bf448229e34f100b6b0afcde1163a461f8c0d7a7
@@ -1,3 +1,6 @@
1
+ ## 3.0.4
2
+ - Fixes issue where decode operation did not support string arguments [#3](https://github.com/logstash-plugins/logstash-codec-gzip_lines/issues/3)
3
+
1
4
  ## 3.0.3
2
5
  - Update gemspec summary
3
6
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
1
+ Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -3,6 +3,7 @@ require "logstash/codecs/base"
3
3
  require "logstash/codecs/plain"
4
4
  require "logstash/json"
5
5
  require "zlib"
6
+ require "stringio"
6
7
 
7
8
  # This codec will read gzip encoded content
8
9
  class LogStash::Codecs::GzipLines < LogStash::Codecs::Base
@@ -29,6 +30,8 @@ class LogStash::Codecs::GzipLines < LogStash::Codecs::Base
29
30
 
30
31
  public
31
32
  def decode(data)
33
+ data = StringIO.new(data) if data.kind_of?(String)
34
+
32
35
  @decoder = Zlib::GzipReader.new(data)
33
36
 
34
37
  begin
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-gzip_lines'
4
- s.version = '3.0.3'
4
+ s.version = '3.0.4'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads `gzip` encoded content"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -26,18 +26,42 @@ describe LogStash::Codecs::GzipLines do
26
26
  str << "2010-03-12 23:51:21 SEA4 192.0.2.222 play 3914 OK bfd8a98bee0840d9b871b7f6ade9908f rtmp://shqshne4jdp4b6.cloudfront.net/cfx/st​ key=value http://player.longtailvideo.com/player.swf http://www.longtailvideo.com/support/jw-player-setup-wizard?example=204 LNX%2010,0,32,18 myvideo p=2&q=4 flv 1\n"
27
27
 
28
28
  str.rewind
29
+
29
30
  str
30
31
  end
31
32
 
32
33
  describe "#decode" do
33
- it "should create events from a gzip file" do
34
- events = []
34
+ let(:compressed_log) { compress_with_gzip(uncompressed_log) }
35
+
36
+ # Legacy tests and implementation _required_ an `IO`-like object to be
37
+ # provided to `LogStash::Codecs::GzipLines#decode`, despite the Logstash
38
+ # API specifying that a `String` is provided. Continue supporting this
39
+ # to avoid breaking implementations that provide an IO.
40
+ context 'when given a StringIO' do
41
+ it "creates one event per line" do
42
+ events = []
43
+
44
+ subject.decode(compressed_log) do |event|
45
+ events << event
46
+ end
35
47
 
36
- subject.decode(compress_with_gzip(uncompressed_log)) do |event|
37
- events << event
48
+ expect(events.size).to eq(2)
38
49
  end
50
+ end
51
+
52
+ context 'when given a String' do
39
53
 
40
- expect(events.size).to eq(2)
54
+ let(:compressed_log) { super().string }
55
+
56
+ it "creates one event per line" do
57
+ events = []
58
+
59
+ subject.decode(compressed_log) do |event|
60
+ events << event
61
+ end
62
+
63
+ expect(events.size).to eq(2)
64
+ end
41
65
  end
42
66
  end
43
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-gzip_lines
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.6.11
101
+ rubygems_version: 2.6.13
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Reads `gzip` encoded content