loggregator_emitter 5.1.1 → 5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/loggregator_emitter/emit.rb +2 -0
- data/loggregator_emitter.gemspec +1 -1
- data/spec/loggregator_emitter/emit_spec.rb +47 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ea729ed5d5e68b64496129d6efbde3e3485dacd
|
4
|
+
data.tar.gz: 19c63bbb1c7094d934446b440db65988ec92a9ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74bf3ea2ef16d396b33a6bb1d8550178d5050948349c34e9cb82851bd0333d66a77155af113a2f3a65df85668dd97649f6356296766d9ee631878c37b88280d8
|
7
|
+
data.tar.gz: afe8c77b9b85ba829d36be69f122947eabf5586ce88bcd493cb8642d1cd4f48c1f05876bcce56f29376de47ed7b9cd0f6a2012036e639ec0d6aeca58531280c2
|
@@ -73,6 +73,8 @@ module LoggregatorEmitter
|
|
73
73
|
def set_tags(tags)
|
74
74
|
envelope_tags = []
|
75
75
|
tags.each do |k, v|
|
76
|
+
raise ArgumentError, "Tag key is too long: #{k.length} (max 256 characters)" unless k.length <= 256
|
77
|
+
raise ArgumentError, "Tag value is too long #{v.length} (max 256 characters)" unless v.length <= 256
|
76
78
|
envelope_tags << ::Sonde::Envelope::TagsEntry.new(:key => k, :value => v)
|
77
79
|
end
|
78
80
|
envelope_tags
|
data/loggregator_emitter.gemspec
CHANGED
@@ -85,6 +85,52 @@ describe LoggregatorEmitter do
|
|
85
85
|
expected_tags
|
86
86
|
end
|
87
87
|
|
88
|
+
describe "max_tag_length" do
|
89
|
+
it "throws an exception when the key is too long" do
|
90
|
+
too_long = "x" * 257
|
91
|
+
tag = {too_long => "a"}
|
92
|
+
|
93
|
+
emitter = LoggregatorEmitter::Emitter.new("0.0.0.0:#{@free_port}", "origin", "API", 42)
|
94
|
+
|
95
|
+
Timecop.freeze timestamp do
|
96
|
+
expect { emitter.emit("my_app_id", "Hello there!", tag) }.to raise_error(ArgumentError)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
it "throws an exception when the value is too long" do
|
101
|
+
too_long = "x" * 257
|
102
|
+
tag = {"a" => too_long}
|
103
|
+
|
104
|
+
emitter = LoggregatorEmitter::Emitter.new("0.0.0.0:#{@free_port}", "origin", "API", 42)
|
105
|
+
|
106
|
+
Timecop.freeze timestamp do
|
107
|
+
expect { emitter.emit("my_app_id", "Hello there!", tag) }.to raise_error(ArgumentError)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
it "counts multi-byte unicode characters as single characters when checking key length" do
|
112
|
+
just_right = "x" * 255 + "Ω"
|
113
|
+
tag = {just_right => "a"}
|
114
|
+
|
115
|
+
emitter = LoggregatorEmitter::Emitter.new("0.0.0.0:#{@free_port}", "origin", "API", 42)
|
116
|
+
|
117
|
+
Timecop.freeze timestamp do
|
118
|
+
expect { emitter.emit("my_app_id", "Hello there!", tag) }.not_to raise_error
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
it "counts multi-byte unicode characters as single characters when checking value length" do
|
123
|
+
just_right = "x" * 255 + "Ω"
|
124
|
+
tag = {"a" => just_right}
|
125
|
+
|
126
|
+
emitter = LoggregatorEmitter::Emitter.new("0.0.0.0:#{@free_port}", "origin", "API", 42)
|
127
|
+
|
128
|
+
Timecop.freeze timestamp do
|
129
|
+
expect { emitter.emit("my_app_id", "Hello there!", tag) }.not_to raise_error
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
88
134
|
let(:timestamp) {Time.now}
|
89
135
|
describe "emit_log_envelope" do
|
90
136
|
def make_emitter(host)
|
@@ -350,7 +396,7 @@ describe LoggregatorEmitter do
|
|
350
396
|
messages = @server.messages
|
351
397
|
expect(messages.length).to eq 1
|
352
398
|
logMessage = messages[0].logMessage
|
353
|
-
expect(logMessage.message.bytesize <= LoggregatorEmitter::Emitter::MAX_MESSAGE_BYTE_SIZE).to
|
399
|
+
expect(logMessage.message.bytesize <= LoggregatorEmitter::Emitter::MAX_MESSAGE_BYTE_SIZE).to be true
|
354
400
|
expect(logMessage.message.slice(-9..-1)).to eq("TRUNCATED")
|
355
401
|
end
|
356
402
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loggregator_emitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: beefcake
|