influxdb 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +92 -0
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +9 -0
- data/README.md +7 -2
- data/Rakefile +1 -1
- data/bin/provision.sh +1 -1
- data/lib/influxdb/client.rb +9 -7
- data/lib/influxdb/config.rb +5 -5
- data/lib/influxdb/query/batch.rb +9 -3
- data/lib/influxdb/query/cluster.rb +2 -2
- data/lib/influxdb/query/continuous_query.rb +1 -1
- data/lib/influxdb/query/core.rb +4 -4
- data/lib/influxdb/query/database.rb +2 -2
- data/lib/influxdb/query/user.rb +8 -8
- data/lib/influxdb/version.rb +1 -1
- data/lib/influxdb/writer/async.rb +38 -11
- data/lib/influxdb/writer/udp.rb +3 -0
- data/spec/influxdb/cases/async_client_spec.rb +57 -33
- data/spec/influxdb/cases/query_cluster_spec.rb +3 -3
- data/spec/influxdb/cases/query_continuous_query_spec.rb +1 -1
- data/spec/influxdb/cases/query_database_spec.rb +4 -4
- data/spec/influxdb/cases/query_series_spec.rb +1 -1
- data/spec/influxdb/cases/query_user_spec.rb +8 -8
- data/spec/influxdb/cases/querying_issue_7000_spec.rb +1 -1
- data/spec/influxdb/cases/querying_spec.rb +1 -1
- data/spec/influxdb/cases/retry_requests_spec.rb +1 -1
- data/spec/influxdb/client_spec.rb +1 -1
- data/spec/influxdb/config_spec.rb +34 -23
- data/spec/influxdb/logging_spec.rb +3 -0
- data/spec/smoke/smoke_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -4
- metadata +7 -7
- data/.travis.yml +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4526b81c8b4e67ca797482a71d10df463feb3c2a6b2750f6038ab6a12d8b6723
|
4
|
+
data.tar.gz: b55ad197088776641d54822d6cada8b57428ddbd00e3441e46ffa841b27a24d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18c2cc024f308f89066f552826a2072904071ca3df33bc47cb4b4476712a9d3d744055667a21791d4eb1b3d521c2de7ba6b1c99d3491e4953287cee332a1b39
|
7
|
+
data.tar.gz: af2a5856340cd70147f95917784ae700e7ea68e53d9de38c115c4e8c4552f74cdb5dcdadb278aa569c4f6b367b3a10c56a9e54ab27ac808252617cd22adf6717
|
@@ -0,0 +1,92 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
# workflow_dispatch enables running workflow manually
|
4
|
+
on: [push, pull_request, workflow_dispatch]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
rubocop:
|
8
|
+
name: RuboCop
|
9
|
+
runs-on: ${{ matrix.os }}
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
os: [ubuntu-20.04]
|
14
|
+
ruby: [2.7]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
bundler-cache: true
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
- run: bundle exec rake rubocop
|
22
|
+
|
23
|
+
specs:
|
24
|
+
name: ${{ matrix.os }} ${{ matrix.ruby }}
|
25
|
+
runs-on: ${{ matrix.os }}
|
26
|
+
strategy:
|
27
|
+
fail-fast: false
|
28
|
+
matrix:
|
29
|
+
os:
|
30
|
+
- ubuntu-16.04
|
31
|
+
- ubuntu-18.04
|
32
|
+
- ubuntu-20.04
|
33
|
+
ruby:
|
34
|
+
- 2.3
|
35
|
+
- 2.4
|
36
|
+
- 2.5
|
37
|
+
- 2.6
|
38
|
+
- 2.7
|
39
|
+
# YAML gotcha: https://github.com/actions/runner/issues/849
|
40
|
+
- '3.0'
|
41
|
+
- head
|
42
|
+
include:
|
43
|
+
- os: ubuntu-20.04
|
44
|
+
ruby: jruby-9.1
|
45
|
+
jruby_opts: '--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
46
|
+
allow-failure: true
|
47
|
+
- os: ubuntu-20.04
|
48
|
+
ruby: jruby-9.2
|
49
|
+
jruby_opts: '--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
50
|
+
allow-failure: true
|
51
|
+
- os: ubuntu-20.04
|
52
|
+
ruby: jruby-head
|
53
|
+
jruby_opts: '--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
54
|
+
allow-failure: true
|
55
|
+
steps:
|
56
|
+
- uses: actions/checkout@v2
|
57
|
+
- uses: ruby/setup-ruby@v1
|
58
|
+
with:
|
59
|
+
bundler-cache: true
|
60
|
+
ruby-version: ${{ matrix.ruby }}
|
61
|
+
- run: bundle exec rake
|
62
|
+
continue-on-error: ${{ matrix.allow-failure || false }}
|
63
|
+
|
64
|
+
smoketests:
|
65
|
+
name: smoketest with influx ${{ matrix.influx_version }}
|
66
|
+
runs-on: ubuntu-20.04
|
67
|
+
strategy:
|
68
|
+
fail-fast: false
|
69
|
+
matrix:
|
70
|
+
include:
|
71
|
+
- { ruby: 2.7, influx_version: 1.0.2, pkghash: 88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037 }
|
72
|
+
- { ruby: 2.7, influx_version: 1.1.5, pkghash: 0ecb9385cc008f6e5094e6e8f8ea70522023a16d4397e401898f3973176d3b21 }
|
73
|
+
- { ruby: 2.7, influx_version: 1.2.4, pkghash: 2fac8391e04aa1bec9151e8f0d8f18df030c866af2b4963ab7d86c6ddc172182 }
|
74
|
+
- { ruby: 2.7, influx_version: 1.3.8, pkghash: 35c9cb2943bbde04aa5e94ad6d8caf5fc9b1480bdbcde7c34078de135cc4f788 }
|
75
|
+
- { ruby: 2.7, influx_version: 1.4.3, pkghash: 0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359 }
|
76
|
+
- { ruby: 2.7, influx_version: 1.5.4, pkghash: fa6f8d3196d13ffc376d533581b534692c738181ce3427c53484c138d9e6b902 }
|
77
|
+
- { ruby: 2.7, influx_version: 1.6.4, pkghash: dbfa13a0f9e38a8e7b19294c30144903bb681ac0aba0a3a8f4f349c37d5de5f9 }
|
78
|
+
- { ruby: 2.7, influx_version: 1.7.9, pkghash: 02759d70cef670d336768fd38a9cf2f046a1bf40618be78ba215e7ce75b5075f }
|
79
|
+
- { ruby: 2.7, influx_version: nightly, channel: nightlies, allow-failure: true }
|
80
|
+
env:
|
81
|
+
influx_version: ${{ matrix.influx_version }}
|
82
|
+
pkghash: ${{ matrix.pkghash }}
|
83
|
+
channel: ${{ matrix.channel }}
|
84
|
+
steps:
|
85
|
+
- uses: actions/checkout@v2
|
86
|
+
- uses: ruby/setup-ruby@v1
|
87
|
+
with:
|
88
|
+
bundler-cache: true
|
89
|
+
ruby-version: ${{ matrix.ruby }}
|
90
|
+
- run: bin/provision.sh
|
91
|
+
- run: bundle exec rake spec
|
92
|
+
continue-on-error: ${{ matrix.allow-failure || false }}
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/commits/master).
|
4
4
|
|
5
|
+
## v0.8.1, release 2021-02-17
|
6
|
+
|
7
|
+
- Ensure workers can send data popped off the queue at shutdown (#239,
|
8
|
+
@onlynone)
|
9
|
+
- Add support for special characters in password when using url keyword (#242,
|
10
|
+
@swistak35)
|
11
|
+
- Add Ruby 3.0 support (#249, @dentarg, @paul and @track8)
|
12
|
+
- Support characters that need quoting for usernames and database names (#248, @estheruary)
|
13
|
+
|
5
14
|
## v0.8.0, released 2020-02-05
|
6
15
|
|
7
16
|
- Allow dropping of specific series from specific DBs (#233, @cantino)
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# influxdb-ruby
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/influxdb.svg)](https://badge.fury.io/rb/influxdb)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/influxdata/influxdb-ruby/workflows/Tests/badge.svg)](https://github.com/influxdata/influxdb-ruby/actions)
|
5
5
|
|
6
6
|
The official Ruby client library for [InfluxDB](https://influxdata.com/time-series-platform/influxdb/).
|
7
7
|
Maintained by [@toddboom](https://github.com/toddboom) and [@dmke](https://github.com/dmke).
|
8
8
|
|
9
|
+
#### Note: This library is for use with InfluxDB 1.x. For connecting to InfluxDB 2.x instances, please use the [influxdb-client-ruby](https://github.com/influxdata/influxdb-client-ruby) client.
|
10
|
+
|
9
11
|
## Contents
|
10
12
|
|
11
13
|
- [Platform support](#platform-support)
|
@@ -295,7 +297,10 @@ async_options = {
|
|
295
297
|
# checking if there are new jobs in the queue
|
296
298
|
sleep_interval: 5,
|
297
299
|
# whether client will block if queue is full
|
298
|
-
block_on_full_queue: false
|
300
|
+
block_on_full_queue: false,
|
301
|
+
# Max time (in seconds) the main thread will wait for worker threads to stop
|
302
|
+
# on shutdown. Defaults to 2x sleep_interval.
|
303
|
+
shutdown_timeout: 10
|
299
304
|
}
|
300
305
|
|
301
306
|
influxdb = InfluxDB::Client.new database, async: async_options
|
data/Rakefile
CHANGED
data/bin/provision.sh
CHANGED
@@ -63,7 +63,7 @@ echo "-- grant access"
|
|
63
63
|
|
64
64
|
echo "== Download and import NOAA sample data"
|
65
65
|
|
66
|
-
curl https://s3
|
66
|
+
curl https://s3.amazonaws.com/noaa.water-database/NOAA_data.txt > noaa.txt
|
67
67
|
/usr/bin/influx -import -path noaa.txt -precision s
|
68
68
|
|
69
69
|
echo "-- grant access"
|
data/lib/influxdb/client.rb
CHANGED
@@ -59,17 +59,19 @@ module InfluxDB
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def stop!
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
writer.worker.stop!
|
62
|
+
if @writer == self
|
63
|
+
@stopped = true
|
64
|
+
else
|
65
|
+
@writer.stop!
|
67
66
|
end
|
68
|
-
@stopped = true
|
69
67
|
end
|
70
68
|
|
71
69
|
def stopped?
|
72
|
-
@
|
70
|
+
if @writer == self
|
71
|
+
@stopped
|
72
|
+
else
|
73
|
+
@writer.stopped?
|
74
|
+
end
|
73
75
|
end
|
74
76
|
|
75
77
|
def now
|
data/lib/influxdb/config.rb
CHANGED
@@ -146,11 +146,11 @@ module InfluxDB
|
|
146
146
|
|
147
147
|
def opts_from_non_params(url)
|
148
148
|
{}.tap do |o|
|
149
|
-
o[:host] = url.host
|
150
|
-
o[:port] = url.port
|
151
|
-
o[:username] = url.user
|
152
|
-
o[:password] = url.password
|
153
|
-
o[:database] = url.path[1..-1]
|
149
|
+
o[:host] = url.host if url.host
|
150
|
+
o[:port] = url.port if url.port
|
151
|
+
o[:username] = URI.decode_www_form_component(url.user) if url.user
|
152
|
+
o[:password] = URI.decode_www_form_component(url.password) if url.password
|
153
|
+
o[:database] = url.path[1..-1] if url.path.length > 1
|
154
154
|
o[:use_ssl] = url.scheme == "https".freeze
|
155
155
|
|
156
156
|
o[:udp] = { host: o[:host], port: o[:port] } if url.scheme == "udp"
|
data/lib/influxdb/query/batch.rb
CHANGED
@@ -27,7 +27,7 @@ module InfluxDB
|
|
27
27
|
)
|
28
28
|
return [] if statements.empty?
|
29
29
|
|
30
|
-
url = full_url "/query".freeze, query_params(statements.join(";"), opts)
|
30
|
+
url = full_url "/query".freeze, **query_params(statements.join(";"), **opts)
|
31
31
|
series = fetch_series get(url, parse: true, json_streaming: !chunk_size.nil?)
|
32
32
|
|
33
33
|
if denormalize
|
@@ -82,8 +82,14 @@ module InfluxDB
|
|
82
82
|
denormalize_series
|
83
83
|
denormalized_series_list
|
84
84
|
].each do |method_name|
|
85
|
-
|
86
|
-
|
85
|
+
if RUBY_VERSION < "2.7"
|
86
|
+
define_method(method_name) do |*args|
|
87
|
+
client.send method_name, *args
|
88
|
+
end
|
89
|
+
else
|
90
|
+
define_method(method_name) do |*args, **kwargs|
|
91
|
+
client.send method_name, *args, **kwargs
|
92
|
+
end
|
87
93
|
end
|
88
94
|
end
|
89
95
|
end
|
@@ -2,7 +2,7 @@ module InfluxDB
|
|
2
2
|
module Query
|
3
3
|
module Cluster # :nodoc:
|
4
4
|
def create_cluster_admin(username, password)
|
5
|
-
execute("CREATE USER #{username} WITH PASSWORD '#{password}' WITH ALL PRIVILEGES")
|
5
|
+
execute("CREATE USER \"#{username}\" WITH PASSWORD '#{password}' WITH ALL PRIVILEGES")
|
6
6
|
end
|
7
7
|
|
8
8
|
def list_cluster_admins
|
@@ -10,7 +10,7 @@ module InfluxDB
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def revoke_cluster_admin_privileges(username)
|
13
|
-
execute("REVOKE ALL PRIVILEGES FROM #{username}")
|
13
|
+
execute("REVOKE ALL PRIVILEGES FROM \"#{username}\"")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/influxdb/query/core.rb
CHANGED
@@ -26,7 +26,7 @@ module InfluxDB
|
|
26
26
|
)
|
27
27
|
query = builder.build(query, params)
|
28
28
|
|
29
|
-
url = full_url("/query".freeze, query_params(query, opts))
|
29
|
+
url = full_url("/query".freeze, **query_params(query, **opts))
|
30
30
|
series = fetch_series(get(url, parse: true, json_streaming: !chunk_size.nil?))
|
31
31
|
|
32
32
|
if block_given?
|
@@ -79,7 +79,7 @@ module InfluxDB
|
|
79
79
|
}
|
80
80
|
|
81
81
|
params[:rp] = retention_policy if retention_policy
|
82
|
-
url = full_url("/write", params)
|
82
|
+
url = full_url("/write", **params)
|
83
83
|
post(url, data)
|
84
84
|
end
|
85
85
|
|
@@ -133,7 +133,7 @@ module InfluxDB
|
|
133
133
|
def execute(query, db: nil, **options)
|
134
134
|
params = { q: query }
|
135
135
|
params[:db] = db if db
|
136
|
-
url = full_url("/query".freeze, params)
|
136
|
+
url = full_url("/query".freeze, **params)
|
137
137
|
get(url, options)
|
138
138
|
end
|
139
139
|
|
@@ -147,7 +147,7 @@ module InfluxDB
|
|
147
147
|
series.select { |k, _| %w[columns values].include?(k) }
|
148
148
|
end
|
149
149
|
|
150
|
-
def full_url(path, params
|
150
|
+
def full_url(path, **params)
|
151
151
|
if config.auth_method == "params".freeze
|
152
152
|
params[:u] = config.username
|
153
153
|
params[:p] = config.password
|
@@ -2,11 +2,11 @@ module InfluxDB
|
|
2
2
|
module Query
|
3
3
|
module Database # :nodoc:
|
4
4
|
def create_database(name = nil)
|
5
|
-
execute("CREATE DATABASE #{name || config.database}")
|
5
|
+
execute("CREATE DATABASE \"#{name || config.database}\"")
|
6
6
|
end
|
7
7
|
|
8
8
|
def delete_database(name = nil)
|
9
|
-
execute("DROP DATABASE #{name || config.database}")
|
9
|
+
execute("DROP DATABASE \"#{name || config.database}\"")
|
10
10
|
end
|
11
11
|
|
12
12
|
def list_databases
|
data/lib/influxdb/query/user.rb
CHANGED
@@ -6,36 +6,36 @@ module InfluxDB
|
|
6
6
|
def create_database_user(database, username, password, options = {})
|
7
7
|
permissions = options.fetch(:permissions, :all)
|
8
8
|
execute(
|
9
|
-
"CREATE user #{username} WITH PASSWORD '#{password}'; "\
|
10
|
-
"GRANT #{permissions.to_s.upcase} ON #{database} TO #{username}"
|
9
|
+
"CREATE user \"#{username}\" WITH PASSWORD '#{password}'; "\
|
10
|
+
"GRANT #{permissions.to_s.upcase} ON \"#{database}\" TO \"#{username}\""
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
14
14
|
def update_user_password(username, password)
|
15
|
-
execute("SET PASSWORD FOR #{username} = '#{password}'")
|
15
|
+
execute("SET PASSWORD FOR \"#{username}\" = '#{password}'")
|
16
16
|
end
|
17
17
|
|
18
18
|
# permission => [:all]
|
19
19
|
def grant_user_admin_privileges(username)
|
20
|
-
execute("GRANT ALL PRIVILEGES TO #{username}")
|
20
|
+
execute("GRANT ALL PRIVILEGES TO \"#{username}\"")
|
21
21
|
end
|
22
22
|
|
23
23
|
# permission => [:read|:write|:all]
|
24
24
|
def grant_user_privileges(username, database, permission)
|
25
|
-
execute("GRANT #{permission.to_s.upcase} ON #{database} TO #{username}")
|
25
|
+
execute("GRANT #{permission.to_s.upcase} ON \"#{database}\" TO \"#{username}\"")
|
26
26
|
end
|
27
27
|
|
28
28
|
def list_user_grants(username)
|
29
|
-
execute("SHOW GRANTS FOR #{username}")
|
29
|
+
execute("SHOW GRANTS FOR \"#{username}\"")
|
30
30
|
end
|
31
31
|
|
32
32
|
# permission => [:read|:write|:all]
|
33
33
|
def revoke_user_privileges(username, database, permission)
|
34
|
-
execute("REVOKE #{permission.to_s.upcase} ON #{database} FROM #{username}")
|
34
|
+
execute("REVOKE #{permission.to_s.upcase} ON \"#{database}\" FROM \"#{username}\"")
|
35
35
|
end
|
36
36
|
|
37
37
|
def delete_user(username)
|
38
|
-
execute("DROP USER #{username}")
|
38
|
+
execute("DROP USER \"#{username}\"")
|
39
39
|
end
|
40
40
|
|
41
41
|
# => [{"username"=>"usr", "admin"=>true}, {"username"=>"justauser", "admin"=>false}]
|
data/lib/influxdb/version.rb
CHANGED
@@ -9,6 +9,16 @@ module InfluxDB
|
|
9
9
|
def initialize(client, config)
|
10
10
|
@client = client
|
11
11
|
@config = config
|
12
|
+
@stopped = false
|
13
|
+
end
|
14
|
+
|
15
|
+
def stopped?
|
16
|
+
@stopped
|
17
|
+
end
|
18
|
+
|
19
|
+
def stop!
|
20
|
+
worker.stop!
|
21
|
+
@stopped = true
|
12
22
|
end
|
13
23
|
|
14
24
|
def write(data, precision = nil, retention_policy = nil, database = nil)
|
@@ -29,7 +39,7 @@ module InfluxDB
|
|
29
39
|
end
|
30
40
|
end
|
31
41
|
|
32
|
-
class Worker
|
42
|
+
class Worker # rubocop:disable Metrics/ClassLength
|
33
43
|
attr_reader :client,
|
34
44
|
:queue,
|
35
45
|
:threads,
|
@@ -37,7 +47,8 @@ module InfluxDB
|
|
37
47
|
:max_queue_size,
|
38
48
|
:num_worker_threads,
|
39
49
|
:sleep_interval,
|
40
|
-
:block_on_full_queue
|
50
|
+
:block_on_full_queue,
|
51
|
+
:shutdown_timeout
|
41
52
|
|
42
53
|
include InfluxDB::Logging
|
43
54
|
|
@@ -47,7 +58,7 @@ module InfluxDB
|
|
47
58
|
SLEEP_INTERVAL = 5
|
48
59
|
BLOCK_ON_FULL_QUEUE = false
|
49
60
|
|
50
|
-
def initialize(client, config)
|
61
|
+
def initialize(client, config) # rubocop:disable Metrics/MethodLength
|
51
62
|
@client = client
|
52
63
|
config = config.is_a?(Hash) ? config : {}
|
53
64
|
|
@@ -56,10 +67,11 @@ module InfluxDB
|
|
56
67
|
@num_worker_threads = config.fetch(:num_worker_threads, NUM_WORKER_THREADS)
|
57
68
|
@sleep_interval = config.fetch(:sleep_interval, SLEEP_INTERVAL)
|
58
69
|
@block_on_full_queue = config.fetch(:block_on_full_queue, BLOCK_ON_FULL_QUEUE)
|
70
|
+
@shutdown_timeout = config.fetch(:shutdown_timeout, 2 * @sleep_interval)
|
59
71
|
|
60
72
|
queue_class = @block_on_full_queue ? SizedQueue : InfluxDB::MaxQueue
|
61
73
|
@queue = queue_class.new max_queue_size
|
62
|
-
|
74
|
+
@should_stop = false
|
63
75
|
spawn_threads!
|
64
76
|
end
|
65
77
|
|
@@ -68,11 +80,11 @@ module InfluxDB
|
|
68
80
|
end
|
69
81
|
|
70
82
|
def current_threads
|
71
|
-
|
83
|
+
@threads
|
72
84
|
end
|
73
85
|
|
74
86
|
def current_thread_count
|
75
|
-
|
87
|
+
@threads.count
|
76
88
|
end
|
77
89
|
|
78
90
|
# rubocop:disable Metrics/CyclomaticComplexity
|
@@ -87,7 +99,7 @@ module InfluxDB
|
|
87
99
|
@threads << Thread.new do
|
88
100
|
Thread.current[:influxdb] = object_id
|
89
101
|
|
90
|
-
until
|
102
|
+
until @should_stop
|
91
103
|
check_background_queue(thread_num)
|
92
104
|
sleep rand(sleep_interval)
|
93
105
|
end
|
@@ -97,7 +109,7 @@ module InfluxDB
|
|
97
109
|
end
|
98
110
|
end
|
99
111
|
|
100
|
-
def check_background_queue(thread_num =
|
112
|
+
def check_background_queue(thread_num = -1)
|
101
113
|
log(:debug) do
|
102
114
|
"Checking background queue on thread #{thread_num} (#{current_thread_count} active)"
|
103
115
|
end
|
@@ -123,10 +135,10 @@ module InfluxDB
|
|
123
135
|
return if data.values.flatten.empty?
|
124
136
|
|
125
137
|
begin
|
126
|
-
log(:debug) { "Found data in the queue! (#{sizes(data)})" }
|
138
|
+
log(:debug) { "Found data in the queue! (#{sizes(data)}) on thread #{thread_num}" }
|
127
139
|
write(data)
|
128
140
|
rescue StandardError => e
|
129
|
-
log :error, "Cannot write data: #{e.inspect}"
|
141
|
+
log :error, "Cannot write data: #{e.inspect} on thread #{thread_num}"
|
130
142
|
end
|
131
143
|
|
132
144
|
break if queue.length > max_post_points
|
@@ -138,7 +150,22 @@ module InfluxDB
|
|
138
150
|
# rubocop:enable Metrics/AbcSize
|
139
151
|
|
140
152
|
def stop!
|
141
|
-
log(:debug) { "
|
153
|
+
log(:debug) { "Worker is being stopped, flushing queue." }
|
154
|
+
|
155
|
+
# If retry was infinite (-1), set it to zero to give the threads one
|
156
|
+
# last chance to write their data
|
157
|
+
client.config.retry = 0 if client.config.retry < 0
|
158
|
+
|
159
|
+
# Signal the background threads that they should exit.
|
160
|
+
@should_stop = true
|
161
|
+
|
162
|
+
# Wait for the threads to exit and then kill them
|
163
|
+
@threads.each do |t|
|
164
|
+
r = t.join(shutdown_timeout)
|
165
|
+
t.kill if r.nil?
|
166
|
+
end
|
167
|
+
|
168
|
+
# Flush any remaining items in the queue on the main thread
|
142
169
|
check_background_queue until queue.empty?
|
143
170
|
end
|
144
171
|
|
data/lib/influxdb/writer/udp.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
require "timeout"
|
3
3
|
|
4
4
|
describe InfluxDB::Client do
|
5
|
-
let(:async_options) {
|
5
|
+
let(:async_options) { { sleep_interval: 0.1 } }
|
6
6
|
let(:client) { described_class.new(async: async_options) }
|
7
7
|
let(:subject) { client }
|
8
8
|
let(:stub_url) { "http://localhost:8086/write?db=&p=root&precision=s&u=root" }
|
@@ -18,14 +18,9 @@ describe InfluxDB::Client do
|
|
18
18
|
subject.write_point('a', values: { i: i })
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
# (and scheduler decisions). On the CI, the system is less
|
23
|
-
# responsive and needs a bit more time.
|
24
|
-
timeout_stretch = ENV["TRAVIS"] == "true" ? 10 : 3
|
21
|
+
sleep 1 until worker.threads.none? { |t| t[:influxdb].nil? }
|
25
22
|
|
26
|
-
|
27
|
-
subject.stop!
|
28
|
-
end
|
23
|
+
subject.stop!
|
29
24
|
|
30
25
|
worker.threads.each do |t|
|
31
26
|
expect(t.stop?).to be true
|
@@ -41,6 +36,7 @@ describe InfluxDB::Client do
|
|
41
36
|
let(:precision) { 'test_precision' }
|
42
37
|
let(:retention_policy) { 'test_period' }
|
43
38
|
let(:database) { 'test_database' }
|
39
|
+
let(:async_options) { { num_worker_threads: 1, sleep_interval: 0.1 } }
|
44
40
|
|
45
41
|
it "writes aggregate payload to the client" do
|
46
42
|
queue = Queue.new
|
@@ -51,9 +47,11 @@ describe InfluxDB::Client do
|
|
51
47
|
subject.write_point(series, { values: { t: 60 } }, precision, retention_policy, database)
|
52
48
|
subject.write_point(series, { values: { t: 61 } }, precision, retention_policy, database)
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
sleep 1 until worker.threads.none? { |t| t[:influxdb].nil? }
|
51
|
+
|
52
|
+
subject.stop!
|
53
|
+
|
54
|
+
expect(queue.pop).to eq ["#{series} t=60i\n#{series} t=61i", precision, retention_policy, database]
|
57
55
|
end
|
58
56
|
|
59
57
|
context 'when different precision, retention_policy and database are given' do
|
@@ -72,36 +70,62 @@ describe InfluxDB::Client do
|
|
72
70
|
subject.write_point(series, { values: { t: 62 } }, precision, retention_policy2, database)
|
73
71
|
subject.write_point(series, { values: { t: 63 } }, precision, retention_policy, database2)
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
sleep 1 until worker.threads.none? { |t| t[:influxdb].nil? }
|
74
|
+
|
75
|
+
subject.stop!
|
76
|
+
|
77
|
+
expect(queue.pop).to eq ["#{series} t=60i", precision, retention_policy, database]
|
78
|
+
expect(queue.pop).to eq ["#{series} t=61i", precision2, retention_policy, database]
|
79
|
+
expect(queue.pop).to eq ["#{series} t=62i", precision, retention_policy2, database]
|
80
|
+
expect(queue.pop).to eq ["#{series} t=63i", precision, retention_policy, database2]
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
describe "async options" do
|
87
|
-
let(:async_options) do
|
88
|
-
{
|
89
|
-
max_post_points: 10,
|
90
|
-
max_queue_size: 100,
|
91
|
-
num_worker_threads: 1,
|
92
|
-
sleep_interval: 0.5,
|
93
|
-
block_on_full_queue: false
|
94
|
-
}
|
95
|
-
end
|
96
|
-
|
97
87
|
subject { worker }
|
98
88
|
before { worker.stop! }
|
99
89
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
90
|
+
context 'when all options are given' do
|
91
|
+
let(:async_options) do
|
92
|
+
{
|
93
|
+
max_post_points: 10,
|
94
|
+
max_queue_size: 100,
|
95
|
+
num_worker_threads: 1,
|
96
|
+
sleep_interval: 0.5,
|
97
|
+
block_on_full_queue: false,
|
98
|
+
shutdown_timeout: 0.6,
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
it "uses the specified values" do
|
103
|
+
expect(subject.max_post_points).to be 10
|
104
|
+
expect(subject.max_queue_size).to be 100
|
105
|
+
expect(subject.num_worker_threads).to be 1
|
106
|
+
expect(subject.sleep_interval).to be_within(0.0001).of(0.5)
|
107
|
+
expect(subject.block_on_full_queue).to be false
|
108
|
+
expect(subject.queue).to be_kind_of(InfluxDB::MaxQueue)
|
109
|
+
expect(subject.shutdown_timeout).to be_within(0.0001).of(0.6)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'when only sleep_interval is given' do
|
114
|
+
let(:async_options) { { sleep_interval: 0.2 } }
|
115
|
+
|
116
|
+
it "uses a value for shutdown_timeout that is 2x sleep_interval" do
|
117
|
+
expect(subject.sleep_interval).to be_within(0.0001).of(0.2)
|
118
|
+
expect(subject.shutdown_timeout).to be_within(0.0001).of(0.4)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'when only shutdown_timeout is given' do
|
123
|
+
let(:async_options) { { shutdown_timeout: 0.3 } }
|
124
|
+
|
125
|
+
it "uses that value" do
|
126
|
+
expect(subject.sleep_interval).to be_within(0.0001).of(5)
|
127
|
+
expect(subject.shutdown_timeout).to be_within(0.0001).of(0.3)
|
128
|
+
end
|
129
|
+
end
|
106
130
|
end
|
107
131
|
end
|
@@ -3,7 +3,7 @@ require "json"
|
|
3
3
|
|
4
4
|
describe InfluxDB::Client do
|
5
5
|
let(:subject) do
|
6
|
-
described_class.new "database", {
|
6
|
+
described_class.new "database", **{
|
7
7
|
host: "influxdb.test",
|
8
8
|
port: 9999,
|
9
9
|
username: "username",
|
@@ -17,7 +17,7 @@ describe InfluxDB::Client do
|
|
17
17
|
describe "#create_cluster_admin" do
|
18
18
|
let(:user) { 'adminadmin' }
|
19
19
|
let(:pass) { 'passpass' }
|
20
|
-
let(:query) { "CREATE USER #{user} WITH PASSWORD '#{pass}' WITH ALL PRIVILEGES" }
|
20
|
+
let(:query) { "CREATE USER \"#{user}\" WITH PASSWORD '#{pass}' WITH ALL PRIVILEGES" }
|
21
21
|
|
22
22
|
context 'with existing admin user' do
|
23
23
|
before do
|
@@ -67,7 +67,7 @@ describe InfluxDB::Client do
|
|
67
67
|
|
68
68
|
describe "#revoke_cluster_admin_privileges" do
|
69
69
|
let(:user) { 'useruser' }
|
70
|
-
let(:query) { "REVOKE ALL PRIVILEGES FROM #{user}" }
|
70
|
+
let(:query) { "REVOKE ALL PRIVILEGES FROM \"#{user}\"" }
|
71
71
|
|
72
72
|
before do
|
73
73
|
stub_request(:get, "http://influxdb.test:9999/query").with(
|
@@ -104,7 +104,7 @@ describe InfluxDB::Client do
|
|
104
104
|
describe "#delete_continuous_query" do
|
105
105
|
let(:name) { "event_counts_per_10m_by_type" }
|
106
106
|
let(:database) { "testdb" }
|
107
|
-
let(:query) { "DROP CONTINUOUS QUERY #{name} ON #{database}" }
|
107
|
+
let(:query) { "DROP CONTINUOUS QUERY \"#{name}\" ON \"#{database}\"" }
|
108
108
|
|
109
109
|
before do
|
110
110
|
stub_request(:get, "http://influxdb.test:9999/query")
|
@@ -23,7 +23,7 @@ describe InfluxDB::Client do
|
|
23
23
|
|
24
24
|
describe "#create_database" do
|
25
25
|
describe "from param" do
|
26
|
-
let(:query) { "CREATE DATABASE foo" }
|
26
|
+
let(:query) { "CREATE DATABASE \"foo\"" }
|
27
27
|
|
28
28
|
it "should GET to create a new database" do
|
29
29
|
expect(subject.create_database("foo")).to be_a(Net::HTTPOK)
|
@@ -31,7 +31,7 @@ describe InfluxDB::Client do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "from config" do
|
34
|
-
let(:query) { "CREATE DATABASE database" }
|
34
|
+
let(:query) { "CREATE DATABASE \"database\"" }
|
35
35
|
|
36
36
|
it "should GET to create a new database using database name from config" do
|
37
37
|
expect(subject.create_database).to be_a(Net::HTTPOK)
|
@@ -41,7 +41,7 @@ describe InfluxDB::Client do
|
|
41
41
|
|
42
42
|
describe "#delete_database" do
|
43
43
|
describe "from param" do
|
44
|
-
let(:query) { "DROP DATABASE foo" }
|
44
|
+
let(:query) { "DROP DATABASE \"foo\"" }
|
45
45
|
|
46
46
|
it "should GET to remove a database" do
|
47
47
|
expect(subject.delete_database("foo")).to be_a(Net::HTTPOK)
|
@@ -49,7 +49,7 @@ describe InfluxDB::Client do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "from config" do
|
52
|
-
let(:query) { "DROP DATABASE database" }
|
52
|
+
let(:query) { "DROP DATABASE \"database\"" }
|
53
53
|
|
54
54
|
it "should GET to remove a database using database name from config" do
|
55
55
|
expect(subject.delete_database).to be_a(Net::HTTPOK)
|
@@ -24,7 +24,7 @@ describe InfluxDB::Client do
|
|
24
24
|
describe "#update user password" do
|
25
25
|
let(:user) { 'useruser' }
|
26
26
|
let(:pass) { 'passpass' }
|
27
|
-
let(:query) { "SET PASSWORD FOR #{user} = '#{pass}'" }
|
27
|
+
let(:query) { "SET PASSWORD FOR \"#{user}\" = '#{pass}'" }
|
28
28
|
|
29
29
|
it "should GET to update user password" do
|
30
30
|
expect(subject.update_user_password(user, pass)).to be_a(Net::HTTPOK)
|
@@ -35,7 +35,7 @@ describe InfluxDB::Client do
|
|
35
35
|
let(:user) { 'useruser' }
|
36
36
|
let(:perm) { :write }
|
37
37
|
let(:db) { 'foo' }
|
38
|
-
let(:query) { "GRANT #{perm.to_s.upcase} ON #{db} TO #{user}" }
|
38
|
+
let(:query) { "GRANT #{perm.to_s.upcase} ON \"#{db}\" TO \"#{user}\"" }
|
39
39
|
|
40
40
|
it "should GET to grant privileges for a user on a database" do
|
41
41
|
expect(subject.grant_user_privileges(user, db, perm)).to be_a(Net::HTTPOK)
|
@@ -44,7 +44,7 @@ describe InfluxDB::Client do
|
|
44
44
|
|
45
45
|
describe "#grant_user_admin_privileges" do
|
46
46
|
let(:user) { 'useruser' }
|
47
|
-
let(:query) { "GRANT ALL PRIVILEGES TO #{user}" }
|
47
|
+
let(:query) { "GRANT ALL PRIVILEGES TO \"#{user}\"" }
|
48
48
|
|
49
49
|
it "should GET to grant privileges for a user on a database" do
|
50
50
|
expect(subject.grant_user_admin_privileges(user)).to be_a(Net::HTTPOK)
|
@@ -55,7 +55,7 @@ describe InfluxDB::Client do
|
|
55
55
|
let(:user) { 'useruser' }
|
56
56
|
let(:perm) { :write }
|
57
57
|
let(:db) { 'foo' }
|
58
|
-
let(:query) { "REVOKE #{perm.to_s.upcase} ON #{db} FROM #{user}" }
|
58
|
+
let(:query) { "REVOKE #{perm.to_s.upcase} ON \"#{db}\" FROM \"#{user}\"" }
|
59
59
|
|
60
60
|
it "should GET to revoke privileges from a user on a database" do
|
61
61
|
expect(subject.revoke_user_privileges(user, db, perm)).to be_a(Net::HTTPOK)
|
@@ -66,7 +66,7 @@ describe InfluxDB::Client do
|
|
66
66
|
let(:user) { 'useruser' }
|
67
67
|
let(:pass) { 'passpass' }
|
68
68
|
let(:db) { 'foo' }
|
69
|
-
let(:query) { "CREATE user #{user} WITH PASSWORD '#{pass}'; GRANT ALL ON #{db} TO #{user}" }
|
69
|
+
let(:query) { "CREATE user \"#{user}\" WITH PASSWORD '#{pass}'; GRANT ALL ON \"#{db}\" TO \"#{user}\"" }
|
70
70
|
|
71
71
|
context "without specifying permissions" do
|
72
72
|
it "should GET to create a new database user with all permissions" do
|
@@ -76,7 +76,7 @@ describe InfluxDB::Client do
|
|
76
76
|
|
77
77
|
context "with passing permission as argument" do
|
78
78
|
let(:permission) { :read }
|
79
|
-
let(:query) { "CREATE user #{user} WITH PASSWORD '#{pass}'; GRANT #{permission.to_s.upcase} ON #{db} TO #{user}" }
|
79
|
+
let(:query) { "CREATE user \"#{user}\" WITH PASSWORD '#{pass}'; GRANT #{permission.to_s.upcase} ON \"#{db}\" TO \"#{user}\"" }
|
80
80
|
|
81
81
|
it "should GET to create a new database user with permission set" do
|
82
82
|
expect(subject.create_database_user(db, user, pass, permissions: permission)).to be_a(Net::HTTPOK)
|
@@ -86,7 +86,7 @@ describe InfluxDB::Client do
|
|
86
86
|
|
87
87
|
describe "#delete_user" do
|
88
88
|
let(:user) { 'useruser' }
|
89
|
-
let(:query) { "DROP USER #{user}" }
|
89
|
+
let(:query) { "DROP USER \"#{user}\"" }
|
90
90
|
|
91
91
|
it "should GET to delete a user" do
|
92
92
|
expect(subject.delete_user(user)).to be_a(Net::HTTPOK)
|
@@ -105,7 +105,7 @@ describe InfluxDB::Client do
|
|
105
105
|
|
106
106
|
describe "#list_user_grants" do
|
107
107
|
let(:user) { 'useruser' }
|
108
|
-
let(:list_query) { "SHOW GRANTS FOR #{user}" }
|
108
|
+
let(:list_query) { "SHOW GRANTS FOR \"#{user}\"" }
|
109
109
|
|
110
110
|
before do
|
111
111
|
stub_request(:get, "http://influxdb.test:9999/query")
|
@@ -1,11 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe InfluxDB::Config do
|
4
|
-
|
5
|
-
|
4
|
+
after { client.stop! }
|
5
|
+
|
6
|
+
let(:client) do
|
7
|
+
kwargs = args.last.is_a?(Hash) ? args.pop : {}
|
8
|
+
InfluxDB::Client.new(*args, **kwargs)
|
6
9
|
end
|
10
|
+
let(:conf) { client.config }
|
7
11
|
|
8
|
-
let(:args) {
|
12
|
+
let(:args) { [] }
|
9
13
|
|
10
14
|
context "with no parameters specified" do
|
11
15
|
specify { expect(conf.database).to be_nil }
|
@@ -26,13 +30,13 @@ describe InfluxDB::Config do
|
|
26
30
|
|
27
31
|
context "with no database specified" do
|
28
32
|
let(:args) do
|
29
|
-
[
|
33
|
+
[
|
30
34
|
host: "host",
|
31
35
|
port: "port",
|
32
36
|
username: "username",
|
33
37
|
password: "password",
|
34
38
|
time_precision: "m"
|
35
|
-
|
39
|
+
]
|
36
40
|
end
|
37
41
|
|
38
42
|
specify { expect(conf.database).to be_nil }
|
@@ -66,7 +70,7 @@ describe InfluxDB::Config do
|
|
66
70
|
end
|
67
71
|
|
68
72
|
context "with ssl option specified" do
|
69
|
-
let(:args) { [
|
73
|
+
let(:args) { [use_ssl: true] }
|
70
74
|
|
71
75
|
specify { expect(conf.database).to be_nil }
|
72
76
|
specify { expect(conf.hosts).to eq ["localhost"] }
|
@@ -77,7 +81,7 @@ describe InfluxDB::Config do
|
|
77
81
|
end
|
78
82
|
|
79
83
|
context "with multiple hosts specified" do
|
80
|
-
let(:args) { [
|
84
|
+
let(:args) { [hosts: ["1.1.1.1", "2.2.2.2"]] }
|
81
85
|
|
82
86
|
specify { expect(conf.database).to be_nil }
|
83
87
|
specify { expect(conf.port).to eq 8086 }
|
@@ -87,7 +91,7 @@ describe InfluxDB::Config do
|
|
87
91
|
end
|
88
92
|
|
89
93
|
context "with auth_method basic auth specified" do
|
90
|
-
let(:args) { [
|
94
|
+
let(:args) { [auth_method: 'basic_auth'] }
|
91
95
|
|
92
96
|
specify { expect(conf.database).to be_nil }
|
93
97
|
specify { expect(conf.hosts).to eq ["localhost"] }
|
@@ -98,38 +102,38 @@ describe InfluxDB::Config do
|
|
98
102
|
end
|
99
103
|
|
100
104
|
context "with udp specified with params" do
|
101
|
-
let(:args) { [
|
105
|
+
let(:args) { [udp: { host: 'localhost', port: 4444 }] }
|
102
106
|
|
103
107
|
specify { expect(conf).to be_udp }
|
104
108
|
end
|
105
109
|
|
106
110
|
context "with udp specified as true" do
|
107
|
-
let(:args) { [
|
111
|
+
let(:args) { [udp: true] }
|
108
112
|
|
109
113
|
specify { expect(conf).to be_udp }
|
110
114
|
end
|
111
115
|
|
112
116
|
context "with async specified with params" do
|
113
|
-
let(:args) { [
|
117
|
+
let(:args) { [async: { max_queue: 20_000 }] }
|
114
118
|
|
115
119
|
specify { expect(conf).to be_async }
|
116
120
|
end
|
117
121
|
|
118
122
|
context "with async specified as true" do
|
119
|
-
let(:args) { [
|
123
|
+
let(:args) { [async: true] }
|
120
124
|
|
121
125
|
specify { expect(conf).to be_async }
|
122
126
|
end
|
123
127
|
|
124
128
|
context "with epoch specified as seconds" do
|
125
|
-
let(:args) { [
|
129
|
+
let(:args) { [epoch: 's'] }
|
126
130
|
|
127
131
|
specify { expect(conf.epoch).to eq 's' }
|
128
132
|
end
|
129
133
|
|
130
134
|
context "given a config URL" do
|
131
135
|
let(:url) { "https://foo:bar@influx.example.com:8765/testdb?open_timeout=42&unknown=false&denormalize=false" }
|
132
|
-
let(:args) { [
|
136
|
+
let(:args) { [url: url] }
|
133
137
|
|
134
138
|
it "applies values found in URL" do
|
135
139
|
expect(conf.database).to eq "testdb"
|
@@ -158,6 +162,15 @@ describe InfluxDB::Config do
|
|
158
162
|
expect(conf).not_to be_async
|
159
163
|
end
|
160
164
|
|
165
|
+
context "with encoded values" do
|
166
|
+
let(:url) { "https://weird%24user:weird%25pass@influx.example.com:8765/testdb" }
|
167
|
+
|
168
|
+
it "decode encoded values" do
|
169
|
+
expect(conf.username).to eq "weird$user"
|
170
|
+
expect(conf.password).to eq "weird%pass"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
161
174
|
context "UDP" do
|
162
175
|
let(:url) { "udp://test.localhost:2345?discard_write_errors=1" }
|
163
176
|
specify { expect(conf).to be_udp }
|
@@ -210,15 +223,13 @@ describe InfluxDB::Config do
|
|
210
223
|
|
211
224
|
context "given explicit proxy information" do
|
212
225
|
let(:args) do
|
213
|
-
[
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
proxy_port: 8080
|
221
|
-
}]
|
226
|
+
[host: "host",
|
227
|
+
port: "port",
|
228
|
+
username: "username",
|
229
|
+
password: "password",
|
230
|
+
time_precision: "m",
|
231
|
+
proxy_addr: "my.proxy.addr",
|
232
|
+
proxy_port: 8080]
|
222
233
|
end
|
223
234
|
|
224
235
|
specify { expect(conf.proxy_addr).to eq("my.proxy.addr") }
|
@@ -38,6 +38,9 @@ describe InfluxDB::Logging do
|
|
38
38
|
context "when logging is disabled" do
|
39
39
|
subject { LoggerTest.new }
|
40
40
|
it "does not log" do
|
41
|
+
pending "The test doesn't work since bugfix in rspec-mocks 3.10.1 " \
|
42
|
+
"(https://github.com/rspec/rspec-mocks/pull/1357)"
|
43
|
+
|
41
44
|
InfluxDB::Logging.logger = false
|
42
45
|
expect(InfluxDB::Logging.logger).not_to receive(:debug)
|
43
46
|
subject.write_to_log(:debug, 'test')
|
data/spec/smoke/smoke_spec.rb
CHANGED
@@ -25,14 +25,14 @@ describe InfluxDB::Client, smoke: true do
|
|
25
25
|
|
26
26
|
context "retrieves data from the NOAA database" do
|
27
27
|
sample_data1 = {
|
28
|
-
"time" => "
|
28
|
+
"time" => "2019-08-17T00:00:00Z",
|
29
29
|
"level description" => "below 3 feet",
|
30
30
|
"location" => "santa_monica",
|
31
31
|
"water_level" => 2.064
|
32
32
|
}
|
33
33
|
|
34
34
|
sample_data2 = {
|
35
|
-
"time" => "
|
35
|
+
"time" => "2019-08-17T00:12:00Z",
|
36
36
|
"level description" => "below 3 feet",
|
37
37
|
"location" => "santa_monica",
|
38
38
|
"water_level" => 2.028
|
data/spec/spec_helper.rb
CHANGED
@@ -17,12 +17,12 @@ def min_influx_version(version)
|
|
17
17
|
end
|
18
18
|
|
19
19
|
RSpec.configure do |config|
|
20
|
-
config.color = ENV["
|
21
|
-
config.filter_run_excluding smoke: ENV["
|
22
|
-
puts "SMOKE TESTS ARE NOT CURRENTLY RUNNING" if ENV["
|
20
|
+
config.color = ENV["CI"] != "true"
|
21
|
+
config.filter_run_excluding smoke: ENV["CI"] != "true" || !ENV.key?("influx_version")
|
22
|
+
puts "SMOKE TESTS ARE NOT CURRENTLY RUNNING" if ENV["CI"] != "true"
|
23
23
|
|
24
24
|
# rubocop:disable Style/ConditionalAssignment
|
25
|
-
if config.files_to_run.one? || ENV["
|
25
|
+
if config.files_to_run.one? || ENV["CI"] == "true"
|
26
26
|
config.formatter = :documentation
|
27
27
|
else
|
28
28
|
config.formatter = :progress
|
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.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,9 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/workflows/tests.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rubocop.yml"
|
92
|
-
- ".travis.yml"
|
93
93
|
- CHANGELOG.md
|
94
94
|
- Gemfile
|
95
95
|
- LICENSE.txt
|
@@ -152,7 +152,7 @@ homepage: http://influxdb.org
|
|
152
152
|
licenses:
|
153
153
|
- MIT
|
154
154
|
metadata: {}
|
155
|
-
post_install_message:
|
155
|
+
post_install_message:
|
156
156
|
rdoc_options: []
|
157
157
|
require_paths:
|
158
158
|
- lib
|
@@ -167,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
-
signing_key:
|
170
|
+
rubygems_version: 3.1.4
|
171
|
+
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Ruby library for InfluxDB.
|
174
174
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
sudo: required
|
2
|
-
dist: trusty
|
3
|
-
language: ruby
|
4
|
-
before_install:
|
5
|
-
- gem update --system --no-doc
|
6
|
-
- bin/provision.sh
|
7
|
-
rvm:
|
8
|
-
- "2.3"
|
9
|
-
- "2.4"
|
10
|
-
- "2.5"
|
11
|
-
- "2.6"
|
12
|
-
- "2.7"
|
13
|
-
- ruby-head
|
14
|
-
env:
|
15
|
-
- TEST_TASK=spec
|
16
|
-
|
17
|
-
matrix:
|
18
|
-
allow_failures:
|
19
|
-
- rvm: jruby-head
|
20
|
-
- rvm: ruby-head
|
21
|
-
- rvm: jruby-9.1.17.0
|
22
|
-
- rvm: jruby-9.2.9.0
|
23
|
-
- rvm: "2.7"
|
24
|
-
env: influx_version=nightly channel=nightlies
|
25
|
-
include:
|
26
|
-
- rvm: "2.7"
|
27
|
-
env: TEST_TASK=rubocop
|
28
|
-
|
29
|
-
- rvm: jruby-9.1.17.0
|
30
|
-
env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
31
|
-
- rvm: jruby-9.2.9.0
|
32
|
-
env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
33
|
-
- rvm: jruby-head
|
34
|
-
env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
|
35
|
-
|
36
|
-
- rvm: "2.7"
|
37
|
-
env: influx_version=1.0.2 pkghash=88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037
|
38
|
-
- rvm: "2.7"
|
39
|
-
env: influx_version=1.1.5 pkghash=0ecb9385cc008f6e5094e6e8f8ea70522023a16d4397e401898f3973176d3b21
|
40
|
-
- rvm: "2.7"
|
41
|
-
env: influx_version=1.2.4 pkghash=2fac8391e04aa1bec9151e8f0d8f18df030c866af2b4963ab7d86c6ddc172182
|
42
|
-
- rvm: "2.7"
|
43
|
-
env: influx_version=1.3.8 pkghash=35c9cb2943bbde04aa5e94ad6d8caf5fc9b1480bdbcde7c34078de135cc4f788
|
44
|
-
- rvm: "2.7"
|
45
|
-
env: influx_version=1.4.3 pkghash=0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359
|
46
|
-
- rvm: "2.7"
|
47
|
-
env: influx_version=1.5.4 pkghash=fa6f8d3196d13ffc376d533581b534692c738181ce3427c53484c138d9e6b902
|
48
|
-
- rvm: "2.7"
|
49
|
-
env: influx_version=1.6.4 pkghash=dbfa13a0f9e38a8e7b19294c30144903bb681ac0aba0a3a8f4f349c37d5de5f9
|
50
|
-
- rvm: "2.7"
|
51
|
-
env: influx_version=1.7.9 pkghash=02759d70cef670d336768fd38a9cf2f046a1bf40618be78ba215e7ce75b5075f
|
52
|
-
- rvm: "2.7"
|
53
|
-
env: influx_version=nightly channel=nightlies
|
54
|
-
addons:
|
55
|
-
apt:
|
56
|
-
packages:
|
57
|
-
- haveged
|
58
|
-
- libgmp-dev
|
59
|
-
script: travis_retry bundle exec rake $TEST_TASK
|