cloudwatchtographite 0.0.0.pre1

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.
@@ -0,0 +1,143 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe CloudwatchToGraphite::MetricDefinition do
4
+ before :each do
5
+ @definition = FactoryGirl.build(
6
+ :metricdefinition,
7
+ MetricName: 'foometricname',
8
+ Namespace: 'foonamespace',
9
+ Unit: 'Bits'
10
+ )
11
+
12
+ @valid_string = 'a' * 255
13
+ @invalid_string = 'z' * 256
14
+ end
15
+
16
+ describe ".create_and_fill" do
17
+ it "should be a MetricDefinition" do
18
+ @definition.should be_an_instance_of \
19
+ CloudwatchToGraphite::MetricDefinition
20
+ end
21
+ it "should require valid arguments" do
22
+ expect {
23
+ CloudwatchToGraphite::MetricDefinition.create_and_fill(
24
+ {'namespace' => 'blah'}
25
+ )
26
+ }.to raise_error(CloudwatchToGraphite::ParseError)
27
+ end
28
+ end
29
+
30
+ describe ".new" do
31
+ it "takes no parameters and returns a MetricDefinition" do
32
+ d = CloudwatchToGraphite::MetricDefinition.new
33
+ d.should be_an_instance_of CloudwatchToGraphite::MetricDefinition
34
+ end
35
+ end
36
+
37
+ describe ".Namespace" do
38
+ it "returns the correct namespace" do
39
+ @definition.Namespace.should eql 'foonamespace'
40
+ end
41
+ end
42
+
43
+ describe ".Namespace=" do
44
+ it "only accepts valid arguments" do
45
+ expect {
46
+ @definition.Namespace = 123
47
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
48
+ expect {
49
+ @definition.Namespace = @invalid_string
50
+ }.to raise_error(CloudwatchToGraphite::ArgumentLengthError)
51
+ @definition.Namespace = @valid_string
52
+ @definition.Namespace.should eql @valid_string
53
+ end
54
+ end
55
+
56
+ describe ".MetricName" do
57
+ it "returns the correct metricname" do
58
+ @definition.MetricName.should eql 'foometricname'
59
+ end
60
+ end
61
+
62
+ describe ".MetricName=" do
63
+ it "only accepts valid arguments" do
64
+ expect {
65
+ @definition.MetricName = 123
66
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
67
+ expect {
68
+ @definition.MetricName = @invalid_string
69
+ }.to raise_error(CloudwatchToGraphite::ArgumentLengthError)
70
+ @definition.MetricName = @valid_string
71
+ @definition.MetricName.should eql @valid_string
72
+ end
73
+ end
74
+
75
+ describe ".Statistics" do
76
+ it "returns the correct statistics" do
77
+ statistics = @definition.Statistics
78
+ statistics.should be_an Array
79
+ statistics.should include 'Sum'
80
+ statistics.should include 'Average'
81
+ statistics.should have(2).items
82
+ end
83
+ end
84
+
85
+ describe ".add_statistic" do
86
+ it "only accepts valid arguments" do
87
+ expect {
88
+ @definition.add_statistic('NotValid')
89
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
90
+ end
91
+ end
92
+
93
+ describe ".add_dimension" do
94
+ it "accepts ten dimensions and no more" do
95
+ dimensions = FactoryGirl.build_list(:metricdimension, 10)
96
+ dimensions.each do |d|
97
+ @definition.add_dimension(d)
98
+ end
99
+ expect {
100
+ @definition.add_dimension(FactoryGirl.build(:metricdimension))
101
+ }.to raise_error(CloudwatchToGraphite::TooManyDimensionError)
102
+ end
103
+ end
104
+
105
+ describe ".Period" do
106
+ it "returns the correct period" do
107
+ @definition.Period.should eql 90
108
+ end
109
+ end
110
+
111
+ describe ".Period=" do
112
+ it "only accepts valid arguments" do
113
+ expect {
114
+ @definition.Period = 'abc'
115
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
116
+ @definition.Period = 1
117
+ @definition.Period.should eql 1
118
+ end
119
+ end
120
+
121
+ describe ".Dimensions" do
122
+ it "returns the correct dimensions" do
123
+ dimensions = FactoryGirl.build_list(:metricdimension, 2)
124
+ dimensions.each do |d|
125
+ @definition.add_dimension(d)
126
+ end
127
+ dimensions = @definition.Dimensions
128
+ dimensions.should be_an Array
129
+ dimensions.should have(2).items
130
+ dimensions.each do |d|
131
+ d.should be_a Hash
132
+ d.should have_key('Name')
133
+ d.should have_key('Value')
134
+ end
135
+ end
136
+ end
137
+
138
+ describe ".Unit" do
139
+ it "returns the correct unit" do
140
+ @definition.Unit.should eql 'Bits'
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,74 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe CloudwatchToGraphite::MetricDimension do
4
+ before :each do
5
+ @dimension = FactoryGirl.build(
6
+ :metricdimension,
7
+ Name: 'testname',
8
+ Value: 'testval'
9
+ )
10
+ @valid_string = 'a' * 255
11
+ @invalid_string = 'z' * 256
12
+ end
13
+
14
+ describe ".new" do
15
+ it "takes two parameters and returns a MetricDimension" do
16
+ @dimension.should be_an_instance_of \
17
+ CloudwatchToGraphite::MetricDimension
18
+ end
19
+ end
20
+
21
+ describe ".create_from_hash" do
22
+ it "should return a MetricDimension" do
23
+ d = CloudwatchToGraphite::MetricDimension.create_from_hash(
24
+ {'name' => 'a', 'value' => 'b'}
25
+ )
26
+ d.should be_an_instance_of CloudwatchToGraphite::MetricDimension
27
+ end
28
+ it "should require valid arguments" do
29
+ expect {
30
+ CloudwatchToGraphite::MetricDimension.create_from_hash(
31
+ {'name' => 'blah'}
32
+ )
33
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
34
+ end
35
+ end
36
+
37
+ describe ".Name" do
38
+ it "returns the correct name" do
39
+ @dimension.Name.should eql 'testname'
40
+ end
41
+ end
42
+
43
+ describe ".Name=" do
44
+ it "only accepts valid arguments" do
45
+ expect {
46
+ @dimension.Name = 123
47
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
48
+ expect {
49
+ @dimension.Name = @invalid_string
50
+ }.to raise_error(CloudwatchToGraphite::ArgumentLengthError)
51
+ @dimension.Name = @valid_string
52
+ @dimension.Name.should eql @valid_string
53
+ end
54
+ end
55
+
56
+ describe ".Name" do
57
+ it "returns the correct value" do
58
+ @dimension.Value.should eql 'testval'
59
+ end
60
+ end
61
+
62
+ describe ".Value=" do
63
+ it "only accepts valid arguments" do
64
+ expect {
65
+ @dimension.Value = 123
66
+ }.to raise_error(CloudwatchToGraphite::ArgumentTypeError)
67
+ expect {
68
+ @dimension.Value = @invalid_string
69
+ }.to raise_error(CloudwatchToGraphite::ArgumentLengthError)
70
+ @dimension.Value = @valid_string
71
+ @dimension.Value.should eql @valid_string
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'coveralls'
3
+ require 'rspec'
4
+ require 'factory_girl'
5
+ RSpec.configure do |config|
6
+ config.include FactoryGirl::Syntax::Methods
7
+ end
8
+ # must come before app requires
9
+ Coveralls.wear!
10
+
11
+ require 'cloudwatchtographite'
12
+
13
+ # Requires supporting files with custom matchers and macros, etc,
14
+ # in ./support/ and its subdirectories.
15
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
16
+
17
+ FactoryGirl.find_definitions
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "CloudwatchToGraphite::VERSION" do
4
+ it "STRING must be defined" do
5
+ CloudwatchToGraphite::VERSION::STRING.should_not be_empty
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloudwatchtographite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.pre1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - S. Zachariah Sprackett
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: unf
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: fog
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.19.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.19.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: hashifiable
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.1.3
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.1.3
78
+ - !ruby/object:Gem::Dependency
79
+ name: rdoc
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec-mocks
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: jeweler
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: cane
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: factory_girl
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ description: Pull statistics from Amazon CloudWatch into Graphite
175
+ email: zac@sprackett.com
176
+ executables:
177
+ - cloudwatch_to_graphite
178
+ extensions: []
179
+ extra_rdoc_files:
180
+ - LICENSE
181
+ - README.md
182
+ files:
183
+ - .coveralls.yml
184
+ - .ruby-version
185
+ - .travis.yml
186
+ - Gemfile
187
+ - LICENSE
188
+ - README.md
189
+ - Rakefile
190
+ - bin/cloudwatch_to_graphite
191
+ - conf/example-metrics.json
192
+ - conf/example-metrics.yaml
193
+ - lib/cloudwatchtographite.rb
194
+ - lib/cloudwatchtographite/exception.rb
195
+ - lib/cloudwatchtographite/loadmetrics.rb
196
+ - lib/cloudwatchtographite/metricdefinition.rb
197
+ - lib/cloudwatchtographite/metricdimension.rb
198
+ - lib/cloudwatchtographite/validator.rb
199
+ - lib/cloudwatchtographite/version.rb
200
+ - spec/cloudwatchtographite_spec.rb
201
+ - spec/factories/metricdefinition.rb
202
+ - spec/factories/metricdimension.rb
203
+ - spec/loadmetrics_spec.rb
204
+ - spec/metricdefinition_spec.rb
205
+ - spec/metricdimension_spec.rb
206
+ - spec/spec_helper.rb
207
+ - spec/version_spec.rb
208
+ homepage: http://github.com/zsprackett/cloudwatchtographite
209
+ licenses:
210
+ - MIT
211
+ post_install_message:
212
+ rdoc_options: []
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ none: false
217
+ requirements:
218
+ - - ! '>='
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ segments:
222
+ - 0
223
+ hash: 4332474145690514089
224
+ required_rubygems_version: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ! '>'
228
+ - !ruby/object:Gem::Version
229
+ version: 1.3.1
230
+ requirements: []
231
+ rubyforge_project:
232
+ rubygems_version: 1.8.23
233
+ signing_key:
234
+ specification_version: 3
235
+ summary: CloudWatch Metrics to Graphite
236
+ test_files: []