influxdb 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,10 +6,10 @@ describe InfluxDB::Client do
6
6
  described_class.new(
7
7
  "database",
8
8
  {
9
- host: "influxdb.test",
10
- port: 9999,
11
- username: "username",
12
- password: "password",
9
+ host: "influxdb.test",
10
+ port: 9999,
11
+ username: "username",
12
+ password: "password",
13
13
  time_precision: "s"
14
14
  }.merge(args)
15
15
  )
@@ -25,10 +25,10 @@ describe InfluxDB::Config do
25
25
  context "with no database specified" do
26
26
  let(:args) do
27
27
  [{
28
- host: "host",
29
- port: "port",
30
- username: "username",
31
- password: "password",
28
+ host: "host",
29
+ port: "port",
30
+ username: "username",
31
+ password: "password",
32
32
  time_precision: "m"
33
33
  }]
34
34
  end
@@ -46,10 +46,10 @@ describe InfluxDB::Config do
46
46
  let(:args) do
47
47
  [
48
48
  "database",
49
- host: "host",
50
- port: "port",
51
- username: "username",
52
- password: "password",
49
+ host: "host",
50
+ port: "port",
51
+ username: "username",
52
+ password: "password",
53
53
  time_precision: "m"
54
54
  ]
55
55
  end
@@ -169,7 +169,7 @@ describe InfluxDB::Config do
169
169
  let(:args) do
170
170
  [
171
171
  "primarydb",
172
- url: url,
172
+ url: url,
173
173
  open_timeout: 20,
174
174
  read_timeout: 30,
175
175
  ]
@@ -5,7 +5,7 @@ describe InfluxDB::PointValue do
5
5
  let(:data) do
6
6
  point = {
7
7
  series: '1= ,"\\1',
8
- tags: {
8
+ tags: {
9
9
  '2= ,"\\2' => '3= ,"\\3'
10
10
  },
11
11
  values: {
@@ -47,10 +47,10 @@ describe InfluxDB::PointValue do
47
47
  end
48
48
  it 'should have proper form' do
49
49
  point = InfluxDB::PointValue.new \
50
- series: "responses",
51
- values: { value: 5, threshold: 0.54 },
52
- tags: { region: 'eu', status: 200 },
53
- timestamp: 1_436_349_652
50
+ series: "responses",
51
+ values: { value: 5, threshold: 0.54 },
52
+ tags: { region: 'eu', status: 200 },
53
+ timestamp: 1_436_349_652
54
54
 
55
55
  expect(point.dump).to eq(expected_value)
56
56
  end
@@ -62,9 +62,9 @@ describe InfluxDB::PointValue do
62
62
  end
63
63
  it 'should have proper form' do
64
64
  point = InfluxDB::PointValue.new \
65
- series: "responses",
66
- values: { value: 5, threshold: 0.54 },
67
- timestamp: 1_436_349_652
65
+ series: "responses",
66
+ values: { value: 5, threshold: 0.54 },
67
+ timestamp: 1_436_349_652
68
68
 
69
69
  expect(point.dump).to eq(expected_value)
70
70
  end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe InfluxDB do
4
+ describe ".convert_timestamp" do
5
+ let(:sometime) { Time.parse("2017-12-11 16:20:29.111222333 UTC") }
6
+
7
+ {
8
+ "ns" => 1_513_009_229_111_222_333,
9
+ nil => 1_513_009_229_111_222_333,
10
+ "u" => 1_513_009_229_111_222,
11
+ "ms" => 1_513_009_229_111,
12
+ "s" => 1_513_009_229,
13
+ "m" => 25_216_820,
14
+ "h" => 420_280,
15
+ }.each do |precision, converted_value|
16
+ it "should return the timestamp in #{precision.inspect}" do
17
+ expect(described_class.convert_timestamp(sometime, precision)).to eq(converted_value)
18
+ end
19
+ end
20
+
21
+ it "should raise an excpetion when precision is unrecognized" do
22
+ expect { described_class.convert_timestamp(sometime, "whatever") }
23
+ .to raise_exception(/invalid time precision.*whatever/i)
24
+ end
25
+ end
26
+ end
@@ -11,6 +11,7 @@ end
11
11
  def min_influx_version(version)
12
12
  v = ENV.fetch("influx_version", "0")
13
13
  return true if v == "nightly"
14
+
14
15
  current = Gem::Version.new(v)
15
16
  current >= Gem::Version.new(version)
16
17
  end
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.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Persen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-23 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.49'
61
+ version: 0.60.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.49'
68
+ version: 0.60.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +115,7 @@ files:
115
115
  - lib/influxdb/query/retention_policy.rb
116
116
  - lib/influxdb/query/series.rb
117
117
  - lib/influxdb/query/user.rb
118
+ - lib/influxdb/timestamp_conversion.rb
118
119
  - lib/influxdb/version.rb
119
120
  - lib/influxdb/writer/async.rb
120
121
  - lib/influxdb/writer/udp.rb
@@ -142,6 +143,7 @@ files:
142
143
  - spec/influxdb/max_queue_spec.rb
143
144
  - spec/influxdb/point_value_spec.rb
144
145
  - spec/influxdb/query_builder_spec.rb
146
+ - spec/influxdb/time_conversion_spec.rb
145
147
  - spec/influxdb/worker_spec.rb
146
148
  - spec/smoke/smoke_batch_spec.rb
147
149
  - spec/smoke/smoke_spec.rb
@@ -166,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
168
  version: '0'
167
169
  requirements: []
168
170
  rubyforge_project:
169
- rubygems_version: 2.7.7
171
+ rubygems_version: 2.7.6
170
172
  signing_key:
171
173
  specification_version: 4
172
174
  summary: Ruby library for InfluxDB.
@@ -195,6 +197,7 @@ test_files:
195
197
  - spec/influxdb/max_queue_spec.rb
196
198
  - spec/influxdb/point_value_spec.rb
197
199
  - spec/influxdb/query_builder_spec.rb
200
+ - spec/influxdb/time_conversion_spec.rb
198
201
  - spec/influxdb/worker_spec.rb
199
202
  - spec/smoke/smoke_batch_spec.rb
200
203
  - spec/smoke/smoke_spec.rb