fluent-plugin-hipchat 0.1.4 → 0.1.5
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 +4 -4
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_hipchat.rb +5 -3
- data/test/plugin/out_hipchat.rb +20 -0
- 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: 41892c64df61d3496d02924d73f14089e969ab09
|
4
|
+
data.tar.gz: 4d7545f990da26894984c0eb2e7148a7bf98567b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0645335bd45ddafe75bd9fd034568a05083ef691408f2ab954ecd37b52b7f476744090b2ba3262b9c196444259e0e2528e03d71795eb484cf56e47f758d73476
|
7
|
+
data.tar.gz: f8883ccf6e965bf0eb74b24c64a224d005a8f4eefb09637405308f516613e1eb524ae1eca7a5b414369973e2fc5085507a1a575a783ff236ca9b900beeed3192
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
@@ -52,7 +52,7 @@ module Fluent
|
|
52
52
|
send_message(record) if record['message']
|
53
53
|
set_topic(record) if record['topic']
|
54
54
|
rescue => e
|
55
|
-
$log.error("HipChat Error:
|
55
|
+
$log.error("HipChat Error:", :error_class => e.class, :error => e.message)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -68,14 +68,16 @@ module Fluent
|
|
68
68
|
end
|
69
69
|
color = COLORS.include?(record['color']) ? record['color'] : @default_color
|
70
70
|
message_format = FORMAT.include?(record['format']) ? record['format'] : @default_format
|
71
|
-
@hipchat.rooms_message(room, from, message, notify, color, message_format)
|
71
|
+
response = @hipchat.rooms_message(room, from, message, notify, color, message_format)
|
72
|
+
raise StandardError, response['error']['message'].to_s if defined?(response['error']['message'])
|
72
73
|
end
|
73
74
|
|
74
75
|
def set_topic(record)
|
75
76
|
room = record['room'] || @default_room
|
76
77
|
from = record['from'] || @default_from
|
77
78
|
topic = record['topic']
|
78
|
-
@hipchat.rooms_topic(room, topic, from)
|
79
|
+
response = @hipchat.rooms_topic(room, topic, from)
|
80
|
+
raise StandardError, response['error']['message'].to_s if defined?(response['error']['message'])
|
79
81
|
end
|
80
82
|
end
|
81
83
|
end
|
data/test/plugin/out_hipchat.rb
CHANGED
@@ -70,6 +70,26 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
70
70
|
d.run
|
71
71
|
end
|
72
72
|
|
73
|
+
def test_set_topic_response_error
|
74
|
+
d = create_driver
|
75
|
+
stub(d.instance.hipchat).rooms_topic('testroom', 'foo', 'testuser') {
|
76
|
+
{'error' => { 'code' => 400, 'type' => 'Bad Request', 'message' => 'Topic body must be between 1 and 250 characters.' } }
|
77
|
+
}
|
78
|
+
stub($log).error("HipChat Error:", :error_class => StandardError, :error => 'Topic body must be between 1 and 250 characters.')
|
79
|
+
d.emit({'topic' => 'foo'})
|
80
|
+
d.run
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_send_message_response_error
|
84
|
+
d = create_driver
|
85
|
+
stub(d.instance.hipchat).rooms_message('testroom', '<abc>', 'foo', 0, 'yellow', 'html') {
|
86
|
+
{'error' => { 'code' => 400, 'type' => 'Bad Request', 'message' => 'From name may not contain HTML.' } }
|
87
|
+
}
|
88
|
+
stub($log).error("HipChat Error:", :error_class => StandardError, :error => 'From name may not contain HTML.')
|
89
|
+
d.emit({'from' => '<abc>', 'message' => 'foo'})
|
90
|
+
d.run
|
91
|
+
end
|
92
|
+
|
73
93
|
def test_color_validate
|
74
94
|
d = create_driver
|
75
95
|
stub(d.instance.hipchat).rooms_message('testroom', 'testuser', 'foo', 0, 'yellow', 'html')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-hipchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuichi Tateno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|