influxdb 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef1ebbbcacc05c56d8bbabdbd22848361b6ac3f6
4
- data.tar.gz: 737cc1c7fb163655ccec58afdb6261084646b620
3
+ metadata.gz: 8d85c5412cee2eed247a9dc36cdd93063dab1006
4
+ data.tar.gz: fb4ea80422af475ec2af1d94918e7682a424537d
5
5
  SHA512:
6
- metadata.gz: 4c1e764c646a040c133c7bf9f2ce299fee0da7091a872437ee2586de8496aea944d9994f57aa3b83c30e4cb0ebf297cf69b4e4cbb910d99a1da2cb5b8218cee5
7
- data.tar.gz: c753626ee6dde17ed931febfe12656e5d7c3c5ab380ad333f28930d464808595805d12649e908383cf2d7287e9281a17f8b1826f236d912c95aa51ea73c5da59
6
+ metadata.gz: 738b8b9a2ce516b1957c4afcdf7a4ab2ef710ddb088bd711ef55f815f11d57a1422bbc67db1d83574fb81ae98441c70d12c4c8a8cfe7bbc3029724d5c3156dae
7
+ data.tar.gz: d70c7129fc4e0f4a7a3b5732826128f168dedd3dcabfe7affdc5816c6c2718fea289368d3d3749aa6956deec7d899ebf9e5334af93293eed38e22635a5ff4e4b
data/.rubocop.yml CHANGED
@@ -15,24 +15,21 @@ AllCops:
15
15
  Rails:
16
16
  Enabled: false
17
17
 
18
- Style/FrozenStringLiteralComment:
18
+ Layout/EmptyLinesAroundArguments:
19
19
  Enabled: false
20
20
 
21
- Style/NumericPredicate:
22
- Enabled: false
21
+ Layout/SpaceBeforeBlockBraces:
22
+ EnforcedStyleForEmptyBraces: space
23
23
 
24
- Style/StringLiterals:
25
- Enabled: false
26
-
27
- Style/RescueModifier:
28
- Enabled: false
24
+ Metrics/AbcSize:
25
+ Max: 20
29
26
 
30
- Metrics/LineLength:
31
- Max: 100
27
+ Metrics/BlockLength:
32
28
  Exclude:
33
29
  - 'spec/**/*.rb'
34
30
 
35
- Metrics/BlockLength:
31
+ Metrics/LineLength:
32
+ Max: 100
36
33
  Exclude:
37
34
  - 'spec/**/*.rb'
38
35
 
@@ -43,13 +40,23 @@ Metrics/ModuleLength:
43
40
  Metrics/ParameterLists:
44
41
  Max: 6
45
42
 
43
+ Style/FormatStringToken:
44
+ Enabled: false
45
+
46
+ Style/FrozenStringLiteralComment:
47
+ Enabled: false
48
+
49
+ Style/NumericPredicate:
50
+ Enabled: false
51
+
52
+ Style/RescueModifier:
53
+ Enabled: false
54
+
55
+ Style/StringLiterals:
56
+ Enabled: false
57
+
46
58
  Style/TrailingCommaInLiteral:
47
59
  EnforcedStyleForMultiline: comma
48
60
  Exclude:
49
61
  - "spec/**/*.rb"
50
62
 
51
- Metrics/AbcSize:
52
- Max: 20
53
-
54
- Style/FormatStringToken:
55
- Enabled: false
data/.travis.yml CHANGED
@@ -5,7 +5,7 @@ before_install:
5
5
  - gem update --system --no-doc
6
6
  - gem install bundler --no-doc
7
7
  - gem update bundler --no-doc
8
- - smoke/provision.sh
8
+ - bin/provision.sh
9
9
  rvm:
10
10
  - 2.2.8
11
11
  - 2.3.5
@@ -20,23 +20,25 @@ matrix:
20
20
  - rvm: ruby-head
21
21
  - rvm: jruby-9.1.5.0
22
22
  - rvm: 2.4.2
23
- env: TEST_TASK=smoke influx_version=nightly channel=nightlies
23
+ env: influx_version=nightly channel=nightlies
24
24
  include:
25
25
  - rvm: 2.4.2
26
26
  env: TEST_TASK=rubocop
27
27
  - rvm: jruby-9.1.5.0
28
28
  - rvm: jruby-head
29
- env: TEST_TASK=spec JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
29
+ env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
30
30
  - rvm: 2.4.2
31
- env: TEST_TASK=smoke influx_version=1.0.2 pkghash=3e4c349cb57507913d9abda1459bdbed
31
+ env: influx_version=1.0.2 pkghash=3e4c349cb57507913d9abda1459bdbed
32
32
  - rvm: 2.4.2
33
- env: TEST_TASK=smoke influx_version=1.1.0 pkghash=682904c350ecfc2a60ec9c6c08453ef2
33
+ env: influx_version=1.1.0 pkghash=682904c350ecfc2a60ec9c6c08453ef2
34
34
  - rvm: 2.4.2
35
- env: TEST_TASK=smoke influx_version=1.2.4 pkghash=0545d67217393282188e5d5cdedfdc85
35
+ env: influx_version=1.2.4 pkghash=0545d67217393282188e5d5cdedfdc85
36
36
  - rvm: 2.4.2
37
- env: TEST_TASK=smoke influx_version=1.3.6 pkghash256=6406cdd21466bcb832b967078adaa9f07cb6ae524a6579c15141692031f5f840
37
+ env: influx_version=1.3.6 pkghash256=6406cdd21466bcb832b967078adaa9f07cb6ae524a6579c15141692031f5f840
38
38
  - rvm: 2.4.2
39
- env: TEST_TASK=smoke influx_version=nightly channel=nightlies
39
+ env: influx_version=1.4.2 pkghash256=96ced90cfc436da7833721fd635b9942f9175cff2f897c113ef068f224cf8605
40
+ - rvm: 2.4.2
41
+ env: influx_version=nightly channel=nightlies
40
42
  fail_fast: true
41
43
  addons:
42
44
  apt:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
6
6
 
7
7
  - None.
8
8
 
9
+ ## v0.5.3, released 2018-01-19
10
+
11
+ - Fix `NoMethodError` in `InfluxDB::Client#list_retention_policies` when
12
+ the database has no RPs defined (#213, @djoos)
13
+
9
14
  ## v0.5.2, released 2017-11-28
10
15
 
11
16
  - Add async option to block on full queue (#209, @davemt)
data/README.md CHANGED
@@ -145,21 +145,36 @@ influxdb.write_point(name, data)
145
145
  influxdb.write_point(name, data, time_precision)
146
146
  ```
147
147
 
148
- > ### A Note About Time Precision
149
- >
150
- > The default precision (in this Rubygem) is `"s"` (second), as Ruby's
151
- > `Time#to_i` operates on this resolution.
152
- >
153
- > If you write data points with sub-second resolution (for example
154
- > via `Time#to_r`), you need to configure your client instance with an
155
- > appropiate `time_precision` option **and** you'll need to provide a
156
- > timestamp value which reflects this precision:
157
- >
158
- > ```ruby
159
- > influxdb = InfluxDB::Client.new time_precision: "ms"
160
- > time = (Time.now.to_r * 1000).to_i
161
- > influxdb.write_point("foobar", { values: { n: 42 }, timestamp: time })
162
- > ```
148
+ ### A Note About Time Precision
149
+
150
+ The default precision in this gem is `"s"` (second), as Ruby's `Time#to_i`
151
+ operates on this resolution.
152
+
153
+ If you write data points with sub-second resolution, you _have_ to configure
154
+ your client instance with a more granular `time_precision` option **and** you
155
+ need to provide timestamp values which reflect this precision. **If you don't do
156
+ this, your points will be squashed!**
157
+
158
+ > A point is uniquely identified by the measurement name, tag set, and
159
+ > timestamp. If you submit a new point with the same measurement, tag set, and
160
+ > timestamp as an existing point, the field set becomes the union of the old
161
+ > field set and the new field set, where any ties go to the new field set. This
162
+ > is the intended behavior.
163
+
164
+ See [How does InfluxDB handle duplicate
165
+ points?](https://docs.influxdata.com/influxdb/v1.3/troubleshooting/frequently-asked-questions/#how-does-influxdb-handle-duplicate-points)
166
+ for details.
167
+
168
+ For example, this is how to specify millisecond precision (which moves the
169
+ pitfall from the second- to the millisecond barrier):
170
+
171
+ ```ruby
172
+ influxdb = InfluxDB::Client.new(time_precision: "ms")
173
+ time = (Time.now.to_r * 1000).to_i
174
+ # A faster, albeit less readable alternative:
175
+ # time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
176
+ influxdb.write_point("foobar", { values: { n: 42 }, timestamp: time })
177
+ ```
163
178
 
164
179
  Allowed values for `time_precision` are:
165
180
 
data/Rakefile CHANGED
@@ -14,12 +14,12 @@ RSpec::Core::RakeTask.new(:spec) do |t|
14
14
  t.pattern = FileList[file_pattern]
15
15
  end
16
16
 
17
- Rake::TestTask.new(:smoke) do |t|
18
- t.test_files = FileList["smoke/*.rb"]
17
+ if ENV.key?("TRAVIS")
18
+ task default: %i[spec]
19
+ else
20
+ task default: %i[spec rubocop]
19
21
  end
20
22
 
21
- task default: %i[spec rubocop]
22
-
23
23
  task :console do
24
24
  lib = File.expand_path("../lib", __FILE__)
25
25
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -44,9 +44,3 @@ task :console do
44
44
  IRB.start
45
45
  end
46
46
  end
47
-
48
- if !ENV.key?("influx_version") || ENV["influx_version"] == ""
49
- task default: :spec
50
- elsif ENV["TRAVIS"] == "true"
51
- task default: :smoke
52
- end
File without changes
data/influxdb.gemspec CHANGED
@@ -2,7 +2,6 @@ lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'influxdb/version'
4
4
 
5
- # rubocop:disable Style/SpecialGlobalVars
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "influxdb"
8
7
  spec.version = InfluxDB::VERSION
@@ -13,8 +12,7 @@ Gem::Specification.new do |spec|
13
12
  spec.homepage = "http://influxdb.org"
14
13
  spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.files = `git ls-files`.split($/) # rubocop:disable Style/SpecialGlobalVars
18
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
19
17
  spec.require_paths = ["lib"]
20
18
 
@@ -78,10 +78,12 @@ module InfluxDB
78
78
  end
79
79
 
80
80
  def resolve_error(response)
81
- if response =~ /Couldn\'t find series/
81
+ case response
82
+ when /Couldn\'t find series/
82
83
  raise InfluxDB::SeriesNotFound, response
84
+ else
85
+ raise InfluxDB::Error, response
83
86
  end
84
- raise InfluxDB::Error, response
85
87
  end
86
88
 
87
89
  def handle_successful_response(response, options)
@@ -130,4 +132,6 @@ module InfluxDB
130
132
  store
131
133
  end
132
134
  end
135
+ # rubocop:enable Metrics/MethodLength
136
+ # rubocop:enable Metrics/AbcSize
133
137
  end
@@ -36,6 +36,7 @@ module InfluxDB
36
36
  invalid: :replace,
37
37
  undef: :replace,
38
38
  replace: "".freeze
39
+ # rubocop:enable Layout/AlignParameters
39
40
 
40
41
  ESCAPES[type].each do |ch|
41
42
  s = s.gsub(ch) { "\\#{ch}" }
@@ -2,7 +2,6 @@ require_relative 'builder'
2
2
 
3
3
  module InfluxDB
4
4
  module Query # :nodoc: all
5
- # rubocop:disable Metrics/AbcSize
6
5
  module Core
7
6
  def builder
8
7
  @builder ||= Builder.new
@@ -17,8 +16,7 @@ module InfluxDB
17
16
  ping.header['x-influxdb-version']
18
17
  end
19
18
 
20
- # rubocop:disable Metrics/MethodLength
21
- def query(
19
+ def query( # rubocop:disable Metrics/MethodLength
22
20
  query,
23
21
  params: nil,
24
22
  denormalize: config.denormalize,
@@ -147,11 +145,16 @@ module InfluxDB
147
145
  params[:p] = config.password
148
146
  end
149
147
 
150
- query = params.map do |k, v|
148
+ URI::Generic.build(
149
+ path: File.join(config.prefix, path),
150
+ query: cgi_escape_params(params)
151
+ ).to_s
152
+ end
153
+
154
+ def cgi_escape_params(params)
155
+ params.map do |k, v|
151
156
  [CGI.escape(k.to_s), "=".freeze, CGI.escape(v.to_s)].join
152
157
  end.join("&".freeze)
153
-
154
- URI::Generic.build(path: File.join(config.prefix, path), query: query).to_s
155
158
  end
156
159
  end
157
160
  end
@@ -17,9 +17,9 @@ module InfluxDB
17
17
 
18
18
  def list_retention_policies(database)
19
19
  resp = execute("SHOW RETENTION POLICIES ON \"#{database}\"", parse: true)
20
- data = fetch_series(resp).fetch(0)
20
+ data = fetch_series(resp).fetch(0, {})
21
21
 
22
- data['values'.freeze].map do |policy|
22
+ data.fetch("values".freeze, []).map do |policy|
23
23
  policy.each.with_index.inject({}) do |hash, (value, index)|
24
24
  hash.tap { |h| h[data['columns'.freeze][index]] = value }
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.5.2".freeze
2
+ VERSION = "0.5.3".freeze
3
3
  end
@@ -131,6 +131,10 @@ module InfluxDB
131
131
  end
132
132
  end
133
133
 
134
+ # rubocop:enable Metrics/CyclomaticComplexity
135
+ # rubocop:enable Metrics/MethodLength
136
+ # rubocop:enable Metrics/AbcSize
137
+
134
138
  def stop!
135
139
  log(:debug) { "Thread exiting, flushing queue." }
136
140
  check_background_queue until queue.empty?
@@ -27,11 +27,23 @@ describe InfluxDB::Client do
27
27
 
28
28
  describe "#list_retention_policies" do
29
29
  let(:query) { "SHOW RETENTION POLICIES ON \"database\"" }
30
- let(:response) { { "results" => [{ "statement_id" => 0, "series" => [{ "columns" => %w[name duration replicaN default], "values" => [["default", "0", 1, true], ["another", "1", 2, false]] }] }] } }
31
- let(:expected_result) { [{ "name" => "default", "duration" => "0", "replicaN" => 1, "default" => true }, { "name" => "another", "duration" => "1", "replicaN" => 2, "default" => false }] }
32
30
 
33
- it "should GET a list of retention policies" do
34
- expect(subject.list_retention_policies('database')).to eq(expected_result)
31
+ context "database with RPs" do
32
+ let(:response) { { "results" => [{ "statement_id" => 0, "series" => [{ "columns" => %w[name duration replicaN default], "values" => [["default", "0", 1, true], ["another", "1", 2, false]] }] }] } }
33
+ let(:expected_result) { [{ "name" => "default", "duration" => "0", "replicaN" => 1, "default" => true }, { "name" => "another", "duration" => "1", "replicaN" => 2, "default" => false }] }
34
+
35
+ it "should GET a list of retention policies" do
36
+ expect(subject.list_retention_policies('database')).to eq(expected_result)
37
+ end
38
+ end
39
+
40
+ context "database without RPs" do
41
+ let(:response) { { "results" => [{ "statement_id" => 0, "series" => [{ "columns" => %w[name duration shardGroupDuration replicaN default] }] }] } }
42
+ let(:expected_result) { [] }
43
+
44
+ it "should GET a list of retention policies" do
45
+ expect(subject.list_retention_policies('database')).to eq(expected_result)
46
+ end
35
47
  end
36
48
  end
37
49
 
@@ -0,0 +1,59 @@
1
+ require "spec_helper"
2
+
3
+ describe InfluxDB::Client, smoke: true do
4
+ before do
5
+ WebMock.allow_net_connect!
6
+ end
7
+
8
+ after do
9
+ WebMock.disable_net_connect!
10
+ end
11
+
12
+ let(:client) do
13
+ InfluxDB::Client.new(database: "NOAA_water_database",
14
+ username: "test_user",
15
+ password: "resu_tset",
16
+ retry: 4)
17
+ end
18
+
19
+ context "connects to the database" do
20
+ it "returns the version number" do
21
+ expect(client.version).to be_truthy
22
+ end
23
+ end
24
+
25
+ context "retrieves data from the NOAA database" do
26
+ sample_data1 = {
27
+ "time" => "2015-08-18T00:00:00Z",
28
+ "level description" => "below 3 feet",
29
+ "location" => "santa_monica",
30
+ "water_level" => 2.064
31
+ }
32
+
33
+ sample_data2 = {
34
+ "time" => "2015-08-18T00:12:00Z",
35
+ "level description" => "below 3 feet",
36
+ "location" => "santa_monica",
37
+ "water_level" => 2.028
38
+ }
39
+
40
+ it "returns all five measurements" do
41
+ result = client.query("show measurements")[0]["values"].map { |v| v["name"] }
42
+ expect(result).to eq(%w[average_temperature h2o_feet h2o_pH h2o_quality h2o_temperature])
43
+ end
44
+
45
+ it "counts the number of non-null values of water level in h2o feet" do
46
+ result = client.query("select count(water_level) from h2o_feet")[0]["values"][0]["count"]
47
+ expect(result).to eq(15_258)
48
+ end
49
+
50
+ it "selects the first five observations in the measurement h2o_feet" do
51
+ result = client
52
+ .query("select * from h2o_feet WHERE location = 'santa_monica'")
53
+ .first["values"]
54
+ expect(result.size). to eq(7654)
55
+ expect(result).to include(sample_data1)
56
+ expect(result).to include(sample_data2)
57
+ end
58
+ end
59
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,7 +10,8 @@ end
10
10
 
11
11
  RSpec.configure do |config|
12
12
  config.color = ENV["TRAVIS"] != "true"
13
-
13
+ config.filter_run_excluding smoke: ENV["TRAVIS"] != "true" || !ENV.key?("influx_version")
14
+ puts "SMOKE TESTS ARE NOT CURRENTLY RUNNING" if ENV["TRAVIS"] != "true"
14
15
  # rubocop:disable Style/ConditionalAssignment
15
16
  if config.files_to_run.one? || ENV["TRAVIS"] == "true"
16
17
  config.formatter = :documentation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Persen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,6 +95,7 @@ files:
95
95
  - LICENSE.txt
96
96
  - README.md
97
97
  - Rakefile
98
+ - bin/provision.sh
98
99
  - influxdb.gemspec
99
100
  - lib/influxdb.rb
100
101
  - lib/influxdb/client.rb
@@ -115,9 +116,6 @@ files:
115
116
  - lib/influxdb/version.rb
116
117
  - lib/influxdb/writer/async.rb
117
118
  - lib/influxdb/writer/udp.rb
118
- - smoke/connect-and-get-version.rb
119
- - smoke/noaa-sample-data.rb
120
- - smoke/provision.sh
121
119
  - spec/influxdb/cases/async_client_spec.rb
122
120
  - spec/influxdb/cases/query_cluster_spec.rb
123
121
  - spec/influxdb/cases/query_continuous_query_spec.rb
@@ -142,6 +140,7 @@ files:
142
140
  - spec/influxdb/point_value_spec.rb
143
141
  - spec/influxdb/query_builder_spec.rb
144
142
  - spec/influxdb/worker_spec.rb
143
+ - spec/smoke/smoke_spec.rb
145
144
  - spec/spec_helper.rb
146
145
  homepage: http://influxdb.org
147
146
  licenses:
@@ -168,9 +167,6 @@ signing_key:
168
167
  specification_version: 4
169
168
  summary: Ruby library for InfluxDB.
170
169
  test_files:
171
- - smoke/connect-and-get-version.rb
172
- - smoke/noaa-sample-data.rb
173
- - smoke/provision.sh
174
170
  - spec/influxdb/cases/async_client_spec.rb
175
171
  - spec/influxdb/cases/query_cluster_spec.rb
176
172
  - spec/influxdb/cases/query_continuous_query_spec.rb
@@ -195,4 +191,5 @@ test_files:
195
191
  - spec/influxdb/point_value_spec.rb
196
192
  - spec/influxdb/query_builder_spec.rb
197
193
  - spec/influxdb/worker_spec.rb
194
+ - spec/smoke/smoke_spec.rb
198
195
  - spec/spec_helper.rb
@@ -1,18 +0,0 @@
1
- require "influxdb"
2
-
3
- puts __FILE__
4
- puts "\tThis file contains some sanity checks."
5
- puts
6
-
7
- client = InfluxDB::Client.new \
8
- username: "test_user",
9
- password: "resu_tset",
10
- retry: 4
11
-
12
- version = client.version
13
-
14
- if version
15
- puts "Got version: #{version}"
16
- else
17
- raise "version is empty"
18
- end
@@ -1,79 +0,0 @@
1
- require "influxdb"
2
-
3
- puts __FILE__
4
- puts "\tThis is basically a test whether the examples in documented on"
5
- puts "\thttp://docs.influxdata.com/influxdb/v0.13/sample_data/data_download/"
6
- puts "\twork with the Ruby client."
7
- puts
8
-
9
- client = InfluxDB::Client.new \
10
- database: "NOAA_water_database",
11
- username: "test_user",
12
- password: "resu_tset",
13
- retry: 4
14
-
15
- TestFailure = Class.new StandardError
16
- TestAllowedFailure = Class.new StandardError
17
-
18
- def test_case(name)
19
- print name
20
- yield
21
- puts " [ OK ]"
22
-
23
- rescue TestAllowedFailure
24
- puts " [WARN]"
25
- puts $!.message
26
-
27
- rescue TestFailure
28
- puts " [FAIL]"
29
- puts $!.message
30
- exit 1
31
- end
32
-
33
- test_case "See all five measurements?" do
34
- result = client.query "show measurements"
35
- expected = %w[ average_temperature h2o_feet h2o_pH h2o_quality h2o_temperature ]
36
- actual = result[0]["values"].map{|v| v["name"] }
37
- unexpected = actual - expected
38
- if unexpected.any?
39
- raise TestFailure, "unexpected measurements: #{unexpected.join(", ")}"
40
- end
41
- end
42
-
43
- test_case "Count the number of non-null values of water_level in h2o_feet" do
44
- result = client.query "select count(water_level) from h2o_feet"
45
- expected = 15258
46
- actual = result[0]["values"][0]["count"]
47
- if expected != actual
48
- raise TestFailure, "expected to find #{expected} points, got #{actual}"
49
- end
50
- end
51
-
52
- test_case "Select the first five observations in the measurement h2o_feet" do
53
- result = client.query("select * from h2o_feet limit 5").first["values"]
54
- expected = 5
55
- actual = result.size
56
- if expected != actual
57
- raise TestFailure, "expected #{expected} observations, got #{actual}"
58
- end
59
-
60
- expected = {
61
- "time" => "2015-08-18T00:00:00Z",
62
- "level description" => "between 6 and 9 feet",
63
- "location" => "coyote_creek",
64
- "water_level" => 8.12
65
- }
66
- if expected != result[0]
67
- raise TestAllowedFailure, "unexpected first result, got #{result[0]}"
68
- end
69
-
70
- expected = {
71
- "time" => "2015-08-18T00:12:00Z",
72
- "level description" => "between 6 and 9 feet",
73
- "location" => "coyote_creek",
74
- "water_level" => 7.887
75
- }
76
- if expected != result[-1]
77
- raise TestAllowedFailure, "unexpected last result, got #{result[-1]}"
78
- end
79
- end