influxdb 0.2.2 → 0.2.3
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/README.md +82 -9
- data/lib/influxdb/config.rb +3 -1
- data/lib/influxdb/query/core.rb +19 -10
- data/lib/influxdb/query/retention_policy.rb +7 -1
- data/lib/influxdb/query/user.rb +9 -0
- data/lib/influxdb/version.rb +1 -1
- data/lib/influxdb/writer/async.rb +1 -1
- data/lib/influxdb/writer/udp.rb +1 -1
- data/spec/influxdb/cases/query_retention_policy_spec.rb +39 -1
- data/spec/influxdb/cases/query_user_spec.rb +30 -0
- data/spec/influxdb/cases/querying_spec.rb +33 -0
- data/spec/influxdb/cases/write_points_spec.rb +37 -0
- data/spec/influxdb/config_spec.rb +9 -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: 91c31bce05c5e0a514a22cef9375f6f51e1f7e3d
|
4
|
+
data.tar.gz: 842b0127d866fb9ed3a3cf0e7d3b878c6d1c5d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f979934171092ad2c2b3c5ff6041cd40663e55d87eaedc8473951097bb1f28d2089acf3448a8dda86e25e521f7ed606314eeb0a9399492a9427c35f39aaebf
|
7
|
+
data.tar.gz: 71d9c02ef46b61c64b6357e2df5886f1cc68517cbdf76da11104223535cb76dc88b73ffa671ad5a83d5afb344c99621c7b46df9d4462461364808f1f7c39810a
|
data/README.md
CHANGED
@@ -194,6 +194,17 @@ name = '1h.cpu'
|
|
194
194
|
influxdb.delete_retention_policy(name, database)
|
195
195
|
```
|
196
196
|
|
197
|
+
Alter a retention policy for a database:
|
198
|
+
|
199
|
+
``` ruby
|
200
|
+
database = 'foo'
|
201
|
+
name = '1h.cpu'
|
202
|
+
duration = '10m'
|
203
|
+
replication = 2
|
204
|
+
|
205
|
+
influxdb.alter_retention_policy(name, database, duration, replication)
|
206
|
+
```
|
207
|
+
|
197
208
|
Write some data:
|
198
209
|
|
199
210
|
``` ruby
|
@@ -226,10 +237,10 @@ Write data with time precision (precision can be set in 2 ways):
|
|
226
237
|
``` ruby
|
227
238
|
require 'influxdb'
|
228
239
|
|
229
|
-
username
|
230
|
-
password
|
231
|
-
database
|
232
|
-
name
|
240
|
+
username = 'foo'
|
241
|
+
password = 'bar'
|
242
|
+
database = 'site_development'
|
243
|
+
name = 'foobar'
|
233
244
|
time_precision = 's'
|
234
245
|
|
235
246
|
# either in the client initialization:
|
@@ -249,6 +260,31 @@ influxdb.write_point(name, data, time_precision)
|
|
249
260
|
|
250
261
|
```
|
251
262
|
|
263
|
+
Write data with a specific retention policy:
|
264
|
+
|
265
|
+
``` ruby
|
266
|
+
require 'influxdb'
|
267
|
+
|
268
|
+
username = 'foo'
|
269
|
+
password = 'bar'
|
270
|
+
database = 'site_development'
|
271
|
+
name = 'foobar'
|
272
|
+
precision = 's'
|
273
|
+
retention = '1h.cpu'
|
274
|
+
|
275
|
+
influxdb = InfluxDB::Client.new database,
|
276
|
+
username: username,
|
277
|
+
password: password
|
278
|
+
|
279
|
+
data = {
|
280
|
+
values: { value: 0 },
|
281
|
+
tags: { foo: 'bar', bar: 'baz' }
|
282
|
+
timestamp: Time.now.to_i
|
283
|
+
}
|
284
|
+
|
285
|
+
influxdb.write_point(name, data, precision, retention)
|
286
|
+
```
|
287
|
+
|
252
288
|
Write multiple points in a batch (performance boost):
|
253
289
|
|
254
290
|
``` ruby
|
@@ -274,7 +310,29 @@ influxdb.write_points(data, precision)
|
|
274
310
|
|
275
311
|
```
|
276
312
|
|
277
|
-
Write
|
313
|
+
Write multiple points in a batch with a specific retention policy:
|
314
|
+
|
315
|
+
``` ruby
|
316
|
+
|
317
|
+
data = [
|
318
|
+
{
|
319
|
+
series: 'cpu',
|
320
|
+
tags: { host: 'server_1', regios: 'us' },
|
321
|
+
values: {internal: 5, external: 0.453345}
|
322
|
+
},
|
323
|
+
{
|
324
|
+
series: 'gpu',
|
325
|
+
values: {value: 0.9999},
|
326
|
+
}
|
327
|
+
]
|
328
|
+
|
329
|
+
precision = 'm'
|
330
|
+
retention = '1h.cpu'
|
331
|
+
influxdb.write_points(data, precision, retention)
|
332
|
+
|
333
|
+
```
|
334
|
+
|
335
|
+
Write asynchronously (note that a retention policy cannot be specified for asynchronous writes):
|
278
336
|
|
279
337
|
``` ruby
|
280
338
|
require 'influxdb'
|
@@ -283,7 +341,6 @@ username = 'foo'
|
|
283
341
|
password = 'bar'
|
284
342
|
database = 'site_development'
|
285
343
|
name = 'foobar'
|
286
|
-
time_precision = 's'
|
287
344
|
|
288
345
|
influxdb = InfluxDB::Client.new database,
|
289
346
|
username: username,
|
@@ -299,7 +356,7 @@ data = {
|
|
299
356
|
influxdb.write_point(name, data)
|
300
357
|
```
|
301
358
|
|
302
|
-
Write data via UDP:
|
359
|
+
Write data via UDP (note that a retention policy cannot be specified for UDP writes):
|
303
360
|
|
304
361
|
``` ruby
|
305
362
|
require 'influxdb'
|
@@ -333,8 +390,8 @@ influxdb = InfluxDB::Client.new database,
|
|
333
390
|
influxdb.query 'select * from time_series_1' # results are grouped by name, but also their tags
|
334
391
|
|
335
392
|
# result:
|
336
|
-
[{"name"=>"time_series_1", "tags"=>{"region"=>"uk"}, "values"=>[{"time"=>"2015-07-09T09:03:31Z", "count"=>32, "value"=>0.9673}, {"time"=>"2015-07-09T09:03:49Z", "count"=>122, "value"=>0.4444}]},
|
337
|
-
{"name"=>"time_series_1", "tags"=>{"region"=>"us"}, "values"=>[{"time"=>"2015-07-09T09:02:54Z", "count"=>55, "value"=>0.4343}]}]
|
393
|
+
# [{"name"=>"time_series_1", "tags"=>{"region"=>"uk"}, "values"=>[{"time"=>"2015-07-09T09:03:31Z", "count"=>32, "value"=>0.9673}, {"time"=>"2015-07-09T09:03:49Z", "count"=>122, "value"=>0.4444}]},
|
394
|
+
# {"name"=>"time_series_1", "tags"=>{"region"=>"us"}, "values"=>[{"time"=>"2015-07-09T09:02:54Z", "count"=>55, "value"=>0.4343}]}]
|
338
395
|
|
339
396
|
# with a block:
|
340
397
|
influxdb.query 'select * from time_series_1' do |name, tags, points|
|
@@ -346,6 +403,22 @@ end
|
|
346
403
|
# time_series_1 [ {"region"=>"us"} ] => [{"time"=>"2015-07-09T09:02:54Z", "count"=>55, "value"=>0.4343}]
|
347
404
|
```
|
348
405
|
|
406
|
+
If you would rather receive points with integer timestamp, it's possible to set `epoch` parameter:
|
407
|
+
|
408
|
+
``` ruby
|
409
|
+
# globally, on client initialization:
|
410
|
+
influxdb = InfluxDB::Client.new database, epoch: 's'
|
411
|
+
|
412
|
+
influxdb.query 'select * from time_series'
|
413
|
+
# result:
|
414
|
+
# [{"name"=>"time_series", "tags"=>{"region"=>"uk"}, "values"=>[{"time"=>1438411376, "count"=>32, "value"=>0.9673}]}]
|
415
|
+
|
416
|
+
# or for a specific query call:
|
417
|
+
influxdb.query 'select * from time_series', epoch: 'ms'
|
418
|
+
# result:
|
419
|
+
# [{"name"=>"time_series", "tags"=>{"region"=>"uk"}, "values"=>[{"time"=>1438411376000, "count"=>32, "value"=>0.9673}]}]
|
420
|
+
```
|
421
|
+
|
349
422
|
By default, InfluxDB::Client will denormalize points (received from InfluxDB as columns and rows), if you want to get _raw_ data add `denormalize: false` to initialization options or to query itself:
|
350
423
|
|
351
424
|
``` ruby
|
data/lib/influxdb/config.rb
CHANGED
@@ -19,7 +19,8 @@ module InfluxDB
|
|
19
19
|
:read_timeout,
|
20
20
|
:retry,
|
21
21
|
:prefix,
|
22
|
-
:denormalize
|
22
|
+
:denormalize,
|
23
|
+
:epoch
|
23
24
|
|
24
25
|
attr_reader :async, :udp
|
25
26
|
|
@@ -44,6 +45,7 @@ module InfluxDB
|
|
44
45
|
@udp = opts.fetch(:udp, false)
|
45
46
|
@retry = opts.fetch(:retry, nil)
|
46
47
|
@denormalize = opts.fetch(:denormalize, true)
|
48
|
+
@epoch = opts.fetch(:epoch, false)
|
47
49
|
@retry =
|
48
50
|
case @retry
|
49
51
|
when Integer
|
data/lib/influxdb/query/core.rb
CHANGED
@@ -8,10 +8,9 @@ module InfluxDB
|
|
8
8
|
|
9
9
|
# rubocop:disable Metrics/MethodLength
|
10
10
|
def query(query, opts = {})
|
11
|
-
precision = opts.fetch(:precision, config.time_precision)
|
12
11
|
denormalize = opts.fetch(:denormalize, config.denormalize)
|
13
|
-
|
14
|
-
url = full_url("/query",
|
12
|
+
params = query_params(query, opts)
|
13
|
+
url = full_url("/query", params)
|
15
14
|
series = fetch_series(get(url, parse: true))
|
16
15
|
|
17
16
|
if block_given?
|
@@ -37,27 +36,37 @@ module InfluxDB
|
|
37
36
|
# values: {value: 0.9999},
|
38
37
|
# }
|
39
38
|
# ])
|
40
|
-
def write_points(data, precision = nil)
|
39
|
+
def write_points(data, precision = nil, retention_policy = nil)
|
41
40
|
data = data.is_a?(Array) ? data : [data]
|
42
41
|
payload = generate_payload(data)
|
43
|
-
writer.write(payload, precision)
|
42
|
+
writer.write(payload, precision, retention_policy)
|
44
43
|
end
|
45
44
|
|
46
45
|
# Example:
|
47
46
|
# write_point('cpu', tags: {region: 'us'}, values: {internal: 60})
|
48
|
-
def write_point(series, data, precision = nil)
|
49
|
-
data.merge
|
50
|
-
write_points(data, precision)
|
47
|
+
def write_point(series, data, precision = nil, retention_policy = nil)
|
48
|
+
write_points(data.merge(series: series), precision, retention_policy)
|
51
49
|
end
|
52
50
|
|
53
|
-
def write(data, precision)
|
51
|
+
def write(data, precision, retention_policy = nil)
|
54
52
|
precision ||= config.time_precision
|
55
|
-
|
53
|
+
params = { db: config.database, precision: precision }
|
54
|
+
params[:rp] = retention_policy if retention_policy
|
55
|
+
url = full_url("/write", params)
|
56
56
|
post(url, data)
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
+
def query_params(query, opts)
|
62
|
+
precision = opts.fetch(:precision, config.time_precision)
|
63
|
+
epoch = opts.fetch(:epoch, config.epoch)
|
64
|
+
|
65
|
+
params = { q: query, db: config.database, precision: precision }
|
66
|
+
params.merge!(epoch: epoch) if epoch
|
67
|
+
params
|
68
|
+
end
|
69
|
+
|
61
70
|
def denormalized_series_list(series)
|
62
71
|
series.map do |s|
|
63
72
|
{
|
@@ -8,7 +8,7 @@ module InfluxDB
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def list_retention_policies(database)
|
11
|
-
resp = execute("SHOW RETENTION POLICIES \"#{database}\"", parse: true)
|
11
|
+
resp = execute("SHOW RETENTION POLICIES ON \"#{database}\"", parse: true)
|
12
12
|
data = fetch_series(resp).fetch(0)
|
13
13
|
|
14
14
|
data['values'].map do |policy|
|
@@ -21,6 +21,12 @@ module InfluxDB
|
|
21
21
|
def delete_retention_policy(name, database)
|
22
22
|
execute("DROP RETENTION POLICY \"#{name}\" ON #{database}")
|
23
23
|
end
|
24
|
+
|
25
|
+
def alter_retention_policy(name, database, duration, replication, default = false)
|
26
|
+
execute(
|
27
|
+
"ALTER RETENTION POLICY \"#{name}\" ON #{database} "\
|
28
|
+
"DURATION #{duration} REPLICATION #{replication}#{default ? ' DEFAULT' : ''}")
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
data/lib/influxdb/query/user.rb
CHANGED
@@ -15,11 +15,20 @@ module InfluxDB
|
|
15
15
|
execute("SET PASSWORD FOR #{username} = '#{password}'")
|
16
16
|
end
|
17
17
|
|
18
|
+
# permission => [:all]
|
19
|
+
def grant_user_admin_privileges(username)
|
20
|
+
execute("GRANT ALL PRIVILEGES TO #{username}")
|
21
|
+
end
|
22
|
+
|
18
23
|
# permission => [:read|:write|:all]
|
19
24
|
def grant_user_privileges(username, database, permission)
|
20
25
|
execute("GRANT #{permission.to_s.upcase} ON #{database} TO #{username}")
|
21
26
|
end
|
22
27
|
|
28
|
+
def list_user_grants(username)
|
29
|
+
execute("SHOW GRANTS FOR #{username}")
|
30
|
+
end
|
31
|
+
|
23
32
|
# permission => [:read|:write|:all]
|
24
33
|
def revoke_user_privileges(username, database, permission)
|
25
34
|
execute("REVOKE #{permission.to_s.upcase} ON #{database} FROM #{username}")
|
data/lib/influxdb/version.rb
CHANGED
data/lib/influxdb/writer/udp.rb
CHANGED
@@ -23,7 +23,7 @@ describe InfluxDB::Client do
|
|
23
23
|
|
24
24
|
before do
|
25
25
|
stub_request(:get, "http://influxdb.test:9999/query").with(
|
26
|
-
query: { u: "username", p: "password", q: "SHOW RETENTION POLICIES \"database\"" }
|
26
|
+
query: { u: "username", p: "password", q: "SHOW RETENTION POLICIES ON \"database\"" }
|
27
27
|
).to_return(body: JSON.generate(response), status: 200)
|
28
28
|
end
|
29
29
|
|
@@ -81,4 +81,42 @@ describe InfluxDB::Client do
|
|
81
81
|
expect(subject.delete_retention_policy('1h.cpu', 'foo')).to be_a(Net::HTTPOK)
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
describe "#alter_retention_policy" do
|
86
|
+
context "default" do
|
87
|
+
before do
|
88
|
+
stub_request(:get, "http://influxdb.test:9999/query")
|
89
|
+
.with(
|
90
|
+
query:
|
91
|
+
{
|
92
|
+
u: "username",
|
93
|
+
p: "password",
|
94
|
+
q: "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 1h REPLICATION 2 DEFAULT"
|
95
|
+
}
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should GET to alter a new database" do
|
100
|
+
expect(subject.alter_retention_policy('1h.cpu', 'foo', '1h', 2, true)).to be_a(Net::HTTPOK)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "non-default" do
|
105
|
+
before do
|
106
|
+
stub_request(:get, "http://influxdb.test:9999/query")
|
107
|
+
.with(
|
108
|
+
query:
|
109
|
+
{
|
110
|
+
u: "username",
|
111
|
+
p: "password",
|
112
|
+
q: "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 1h REPLICATION 2"
|
113
|
+
}
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should GET to alter a new database" do
|
118
|
+
expect(subject.alter_retention_policy('1h.cpu', 'foo', '1h', 2)).to be_a(Net::HTTPOK)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
84
122
|
end
|
@@ -50,6 +50,21 @@ describe InfluxDB::Client do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
describe "#grant_user_admin_privileges" do
|
54
|
+
let(:user) { 'useruser' }
|
55
|
+
let(:query) { "GRANT ALL PRIVILEGES TO #{user}" }
|
56
|
+
|
57
|
+
before do
|
58
|
+
stub_request(:get, "http://influxdb.test:9999/query").with(
|
59
|
+
query: { u: "username", p: "password", q: query }
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should GET to grant privileges for a user on a database" do
|
64
|
+
expect(subject.grant_user_admin_privileges(user)).to be_a(Net::HTTPOK)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
53
68
|
describe "#revoke_user_privileges" do
|
54
69
|
let(:user) { 'useruser' }
|
55
70
|
let(:perm) { :write }
|
@@ -124,4 +139,19 @@ describe InfluxDB::Client do
|
|
124
139
|
expect(subject.list_users).to eq(expected_result)
|
125
140
|
end
|
126
141
|
end
|
142
|
+
|
143
|
+
describe "#list_user_grants" do
|
144
|
+
let(:user) { 'useruser' }
|
145
|
+
let(:list_query) { "SHOW GRANTS FOR #{user}" }
|
146
|
+
|
147
|
+
before do
|
148
|
+
stub_request(:get, "http://influxdb.test:9999/query").with(
|
149
|
+
query: { u: "username", p: "password", q: list_query},
|
150
|
+
).to_return(:status => 200, :body => "", :headers => {})
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should GET for a user" do
|
154
|
+
expect(subject.list_user_grants(user)).to be_a(Net::HTTPOK)
|
155
|
+
end
|
156
|
+
end
|
127
157
|
end
|
@@ -145,5 +145,38 @@ describe InfluxDB::Client do
|
|
145
145
|
expect(results).to eq(expected_result)
|
146
146
|
end
|
147
147
|
end
|
148
|
+
|
149
|
+
context "with epoch set to seconds" do
|
150
|
+
let(:args) { {epoch: 's'} }
|
151
|
+
|
152
|
+
let(:response) do
|
153
|
+
{ "results" =>
|
154
|
+
[{ "series" =>
|
155
|
+
[{ "name" => "cpu", "tags" => { "region" => "pl" }, "columns" => %w(time temp value), "values" => [[1438580576, 34, 0.343443]] },
|
156
|
+
{ "name" => "cpu", "tags" => { "region" => "us" }, "columns" => %w(time temp value), "values" => [[1438612976, 92, 0.3445], [1438612989, 68, 0.8787]] }
|
157
|
+
]
|
158
|
+
}]
|
159
|
+
}
|
160
|
+
end
|
161
|
+
let(:expected_result) do
|
162
|
+
[{ "name" => "cpu", "tags" => { "region" => "pl" },
|
163
|
+
"values" => [{ "time" => 1438580576, "temp" => 34, "value" => 0.343443 }] },
|
164
|
+
{ "name" => "cpu", "tags" => { "region" => "us" },
|
165
|
+
"values" => [{ "time" => 1438612976, "temp" => 92, "value" => 0.3445 },
|
166
|
+
{ "time" => 1438612989, "temp" => 68, "value" => 0.8787 }]
|
167
|
+
}]
|
168
|
+
end
|
169
|
+
let(:query) { 'SELECT * FROM cpu' }
|
170
|
+
|
171
|
+
before do
|
172
|
+
stub_request(:get, "http://influxdb.test:9999/query").with(
|
173
|
+
query: { q: query, u: "username", p: "password", precision: 's', db: database, epoch: 's' }
|
174
|
+
).to_return(body: JSON.generate(response))
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should return results with integer timestamp" do
|
178
|
+
expect(subject.query(query)).to eq(expected_result)
|
179
|
+
end
|
180
|
+
end
|
148
181
|
end
|
149
182
|
end
|
@@ -40,6 +40,13 @@ describe InfluxDB::Client do
|
|
40
40
|
it "should POST to add single point" do
|
41
41
|
expect(subject.write_point(series, data)).to be_a(Net::HTTPOK)
|
42
42
|
end
|
43
|
+
|
44
|
+
it "should not mutate data object" do
|
45
|
+
original_data = data
|
46
|
+
subject.write_point(series, data)
|
47
|
+
expect(data[:series]).to be_nil
|
48
|
+
expect(original_data).to eql(data)
|
49
|
+
end
|
43
50
|
end
|
44
51
|
|
45
52
|
describe "#write_points" do
|
@@ -136,5 +143,35 @@ describe InfluxDB::Client do
|
|
136
143
|
expect(subject.write_points(data, 'm')).to be_a(Net::HTTPOK)
|
137
144
|
end
|
138
145
|
end
|
146
|
+
|
147
|
+
context "with retention policy" do
|
148
|
+
let(:data) do
|
149
|
+
[{
|
150
|
+
series: 'cpu',
|
151
|
+
values: { temp: 88, value: 54 }
|
152
|
+
},
|
153
|
+
{
|
154
|
+
series: 'gpu',
|
155
|
+
values: { value: 0.5435345 }
|
156
|
+
}]
|
157
|
+
end
|
158
|
+
|
159
|
+
let(:body) do
|
160
|
+
data.map do |point|
|
161
|
+
InfluxDB::PointValue.new(point).dump
|
162
|
+
end.join("\n")
|
163
|
+
end
|
164
|
+
|
165
|
+
before do
|
166
|
+
stub_request(:post, "http://influxdb.test:9999/write").with(
|
167
|
+
query: { u: "username", p: "password", precision: 's', db: database, rp: 'rp_1_hour' },
|
168
|
+
headers: { "Content-Type" => "application/octet-stream" },
|
169
|
+
body: body
|
170
|
+
)
|
171
|
+
end
|
172
|
+
it "should POST multiple points" do
|
173
|
+
expect(subject.write_points(data, nil, 'rp_1_hour')).to be_a(Net::HTTPOK)
|
174
|
+
end
|
175
|
+
end
|
139
176
|
end
|
140
177
|
end
|
@@ -19,6 +19,7 @@ describe InfluxDB::Config do
|
|
19
19
|
specify { expect(conf.denormalize).to be_truthy }
|
20
20
|
specify { expect(conf).not_to be_udp }
|
21
21
|
specify { expect(conf).not_to be_async }
|
22
|
+
specify { expect(conf.epoch).to be_falsey }
|
22
23
|
end
|
23
24
|
|
24
25
|
context "with no database specified" do
|
@@ -38,6 +39,7 @@ describe InfluxDB::Config do
|
|
38
39
|
specify { expect(conf.username).to eq "username" }
|
39
40
|
specify { expect(conf.password).to eq "password" }
|
40
41
|
specify { expect(conf.time_precision).to eq "m" }
|
42
|
+
specify { expect(conf.epoch).to be_falsey }
|
41
43
|
end
|
42
44
|
|
43
45
|
context "with both a database and options specified" do
|
@@ -58,6 +60,7 @@ describe InfluxDB::Config do
|
|
58
60
|
specify { expect(conf.username).to eq "username" }
|
59
61
|
specify { expect(conf.password).to eq "password" }
|
60
62
|
specify { expect(conf.time_precision).to eq "m" }
|
63
|
+
specify { expect(conf.epoch).to be_falsey }
|
61
64
|
end
|
62
65
|
|
63
66
|
context "with ssl option specified" do
|
@@ -115,4 +118,10 @@ describe InfluxDB::Config do
|
|
115
118
|
|
116
119
|
specify { expect(conf).to be_async }
|
117
120
|
end
|
121
|
+
|
122
|
+
context "with epoch specified as seconds" do
|
123
|
+
let(:args) { [{ epoch: 's' }] }
|
124
|
+
|
125
|
+
specify { expect(conf.epoch).to eq 's' }
|
126
|
+
end
|
118
127
|
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.2.
|
4
|
+
version: 0.2.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: 2015-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|