drone_collectd 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../../common', __FILE__)
2
+
3
+ require 'drone_collectd/parser'
4
+ include DroneCollectd
5
+
6
+ describe 'Packet Parser' do
7
+ before do
8
+ @packet = CollectdPacket.new()
9
+
10
+ @packet.host = "localhost"
11
+ @packet.time = 1
12
+ @packet.interval = 10
13
+ @packet.plugin = "plugin"
14
+ @packet.plugin_instance = "plugin_instance"
15
+ @packet.type = "type"
16
+ @packet.type_instance = "type_instance"
17
+ @packet.add_value(:counter, 42)
18
+ end
19
+
20
+ it 'can generate a packet' do
21
+ expected = [
22
+ "\x00\x00\x00\x0elocalhost\x00", # host
23
+ "\x00\x01\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x01", # time
24
+ "\x00\x07\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x0a", # interval
25
+ "\x00\x02\x00\x0bplugin\x00", # plugin
26
+ "\x00\x03\x00\x14plugin_instance\x00", # plugin_instance
27
+ "\x00\x04\x00\x09type\x00", # type
28
+ "\x00\x05\x00\x12type_instance\x00", # type_instance
29
+ "\x00\x06\x00\x0f\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x2a" # value
30
+
31
+ ]
32
+
33
+ if "".respond_to?(:encode)
34
+ expected = expected.map{|s| s.encode('ASCII') }
35
+ end
36
+
37
+ data = @packet.build_packet
38
+
39
+ data[0,14].should == expected[0]
40
+ data[14,12].should == expected[1]
41
+ data[26,12].should == expected[2]
42
+ data[38,11].should == expected[3]
43
+ data[49,20].should == expected[4]
44
+ data[69, 9].should == expected[5]
45
+ data[78,18].should == expected[6]
46
+ data[96,15].should == expected[7]
47
+ end
48
+
49
+ end
Binary file
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: drone_collectd
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Julien Ammous
@@ -98,8 +98,21 @@ extensions: []
98
98
 
99
99
  extra_rdoc_files: []
100
100
 
101
- files: []
102
-
101
+ files:
102
+ - LICENSE
103
+ - README.md
104
+ - lib/drone_collectd/collectd.rb
105
+ - lib/drone_collectd/collectd.rbc
106
+ - lib/drone_collectd/parser.rb
107
+ - lib/drone_collectd/parser.rbc
108
+ - lib/drone_collectd/parser_old.rb
109
+ - lib/drone_collectd/version.rbc
110
+ - lib/drone_collectd.rb
111
+ - lib/drone_collectd.rbc
112
+ - specs/common.rb
113
+ - specs/common.rbc
114
+ - specs/unit/parser_spec.rb
115
+ - specs/unit/parser_spec.rbc
103
116
  homepage: ""
104
117
  licenses: []
105
118
 
@@ -123,10 +136,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
136
  requirements: []
124
137
 
125
138
  rubyforge_project: drone_collectd
126
- rubygems_version: 1.7.2
139
+ rubygems_version: 1.8.1
127
140
  signing_key:
128
141
  specification_version: 3
129
142
  summary: Drone Collectd Interface
130
- test_files: []
131
-
132
- has_rdoc:
143
+ test_files:
144
+ - specs/common.rb
145
+ - specs/common.rbc
146
+ - specs/unit/parser_spec.rb
147
+ - specs/unit/parser_spec.rbc