influxdb-client 1.0.0.pre.191 → 1.1.0.pre.459
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/.circleci/setup-rubygems.sh +1 -1
- data/.codecov.yml +3 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +8 -1
- data/README.md +71 -2
- data/bin/generate-sources.sh +30 -0
- data/bin/pom.xml +34 -0
- data/bin/swagger.yml +9867 -0
- data/lib/influxdb2/client.rb +3 -0
- data/lib/influxdb2/client/client.rb +13 -2
- data/lib/influxdb2/client/default_api.rb +68 -0
- data/lib/influxdb2/client/flux_csv_parser.rb +246 -0
- data/lib/influxdb2/client/flux_table.rb +99 -0
- data/lib/influxdb2/client/models/dialect.rb +317 -0
- data/lib/influxdb2/client/models/query.rb +284 -0
- data/lib/influxdb2/client/point.rb +1 -0
- data/lib/influxdb2/client/query_api.rb +93 -0
- data/lib/influxdb2/client/version.rb +1 -1
- data/lib/influxdb2/client/worker.rb +89 -0
- data/lib/influxdb2/client/write_api.rb +106 -41
- data/test/influxdb/flux_csv_parser_test.rb +326 -0
- data/test/influxdb/query_api_integration_test.rb +58 -0
- data/test/influxdb/query_api_stream_test.rb +98 -0
- data/test/influxdb/query_api_test.rb +75 -0
- data/test/influxdb/write_api_batching_test.rb +153 -0
- data/test/test_helper.rb +4 -1
- metadata +23 -2
@@ -0,0 +1,58 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'test_helper'
|
22
|
+
|
23
|
+
class QueryApiIntegrationTest < MiniTest::Test
|
24
|
+
def setup
|
25
|
+
WebMock.allow_net_connect!
|
26
|
+
|
27
|
+
@client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
|
28
|
+
bucket: 'my-bucket',
|
29
|
+
org: 'my-org',
|
30
|
+
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
31
|
+
use_ssl: false)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_query
|
35
|
+
now = Time.now.utc
|
36
|
+
measurement = 'h2o_query_' + now.to_i.to_s
|
37
|
+
|
38
|
+
@client.create_write_api.write(data: InfluxDB2::Point.new(name: measurement)
|
39
|
+
.add_tag('location', 'europe')
|
40
|
+
.add_field('level', 2)
|
41
|
+
.time(now, InfluxDB2::WritePrecision::NANOSECOND))
|
42
|
+
|
43
|
+
result = @client.create_query_api.query(query: 'from(bucket: "my-bucket") |> range(start: -1m, stop: now()) '\
|
44
|
+
"|> filter(fn: (r) => r._measurement == \"#{measurement}\")")
|
45
|
+
|
46
|
+
assert_equal 1, result.size
|
47
|
+
|
48
|
+
records = result[0].records
|
49
|
+
assert_equal 1, records.size
|
50
|
+
|
51
|
+
record = records[0]
|
52
|
+
|
53
|
+
assert_equal measurement, record.measurement
|
54
|
+
assert_equal 'europe', record.values['location']
|
55
|
+
assert_equal 2, record.value
|
56
|
+
assert_equal 'level', record.field
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'test_helper'
|
22
|
+
|
23
|
+
class QueryApiStreamTest < MiniTest::Test
|
24
|
+
def setup
|
25
|
+
WebMock.allow_net_connect!
|
26
|
+
|
27
|
+
@client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
|
28
|
+
bucket: 'my-bucket',
|
29
|
+
org: 'my-org',
|
30
|
+
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
31
|
+
use_ssl: false)
|
32
|
+
@now = Time.now.utc
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_query_stream
|
36
|
+
measurement = 'h2o_query_stream' + @now.to_i.to_s + @now.nsec.to_s
|
37
|
+
_write(10, measurement: measurement)
|
38
|
+
|
39
|
+
query = 'from(bucket: "my-bucket") |> range(start: -1m, stop: now()) ' \
|
40
|
+
"|> filter(fn: (r) => r._measurement == \"#{measurement}\")"
|
41
|
+
|
42
|
+
count = 0
|
43
|
+
@client.create_query_api.query_stream(query: query).each do |record|
|
44
|
+
count += 1
|
45
|
+
assert_equal measurement, record.measurement
|
46
|
+
assert_equal 'europe', record.values['location']
|
47
|
+
assert_equal count, record.value
|
48
|
+
assert_equal 'level', record.field
|
49
|
+
end
|
50
|
+
|
51
|
+
assert_equal 10, count
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_query_stream_break
|
55
|
+
measurement = 'h2o_query_stream_break' + @now.to_i.to_s + @now.nsec.to_s
|
56
|
+
_write(20, measurement: measurement)
|
57
|
+
|
58
|
+
query = 'from(bucket: "my-bucket") |> range(start: -1m, stop: now()) ' \
|
59
|
+
"|> filter(fn: (r) => r._measurement == \"#{measurement}\")"
|
60
|
+
|
61
|
+
records = []
|
62
|
+
|
63
|
+
parser = @client.create_query_api.query_stream(query: query)
|
64
|
+
|
65
|
+
assert_equal false, parser.closed
|
66
|
+
|
67
|
+
count = 0
|
68
|
+
parser.each do |record|
|
69
|
+
records.push(record)
|
70
|
+
count += 1
|
71
|
+
|
72
|
+
break if count >= 5
|
73
|
+
end
|
74
|
+
|
75
|
+
assert_equal 5, records.size
|
76
|
+
assert_equal true, parser.closed
|
77
|
+
|
78
|
+
# record 1
|
79
|
+
record = records[0]
|
80
|
+
assert_equal measurement, record.measurement
|
81
|
+
assert_equal 'europe', record.values['location']
|
82
|
+
assert_equal 1, record.value
|
83
|
+
assert_equal 'level', record.field
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def _write(values, measurement:)
|
89
|
+
write_api = @client.create_write_api
|
90
|
+
|
91
|
+
(1..values).each do |value|
|
92
|
+
write_api.write(data: InfluxDB2::Point.new(name: measurement)
|
93
|
+
.add_tag('location', 'europe')
|
94
|
+
.add_field('level', value)
|
95
|
+
.time(@now - values + value, InfluxDB2::WritePrecision::NANOSECOND))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'test_helper'
|
22
|
+
|
23
|
+
class QueryApiTest < MiniTest::Test
|
24
|
+
def setup
|
25
|
+
WebMock.disable_net_connect!
|
26
|
+
end
|
27
|
+
|
28
|
+
SUCCESS_DATA = '#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,' \
|
29
|
+
"long,string,string,string,string\n" \
|
30
|
+
"#group,false,false,false,false,false,false,false,false,false,true\n" + "#default,_result,,,,,,,,,\n" \
|
31
|
+
",result,table,_start,_stop,_time,_value,_field,_measurement,host,region\n" \
|
32
|
+
",,0,1970-01-01T00:00:10Z,1970-01-01T00:00:20Z,1970-01-01T00:00:10Z,10,free,mem,A,west\n" \
|
33
|
+
",,0,1970-01-01T00:00:10Z,1970-01-01T00:00:20Z,1970-01-01T00:00:10Z,20,free,mem,B,west\n" \
|
34
|
+
",,0,1970-01-01T00:00:20Z,1970-01-01T00:00:30Z,1970-01-01T00:00:20Z,11,free,mem,A,west\n" \
|
35
|
+
',,0,1970-01-01T00:00:20Z,1970-01-01T00:00:30Z,1970-01-01T00:00:20Z,22,free,mem,B,west'
|
36
|
+
|
37
|
+
def test_query_raw
|
38
|
+
stub_request(:post, 'http://localhost:9999/api/v2/query?org=my-org')
|
39
|
+
.to_return(body: SUCCESS_DATA)
|
40
|
+
client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
|
41
|
+
bucket: 'my-bucket',
|
42
|
+
org: 'my-org',
|
43
|
+
use_ssl: false)
|
44
|
+
|
45
|
+
bucket = 'my-bucket'
|
46
|
+
result = client.create_query_api.query_raw(query:
|
47
|
+
'from(bucket:"' + bucket + '") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()')
|
48
|
+
|
49
|
+
assert_equal result, SUCCESS_DATA
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_query
|
53
|
+
stub_request(:post, 'http://localhost:9999/api/v2/query?org=my-org')
|
54
|
+
.to_return(body: SUCCESS_DATA)
|
55
|
+
|
56
|
+
client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
|
57
|
+
bucket: 'my-bucket',
|
58
|
+
org: 'my-org',
|
59
|
+
use_ssl: false)
|
60
|
+
|
61
|
+
bucket = 'my-bucket'
|
62
|
+
result = client.create_query_api.query(query:
|
63
|
+
'from(bucket:"' + bucket + '") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()')
|
64
|
+
|
65
|
+
assert_equal 1, result.length
|
66
|
+
assert_equal 4, result[0].records.length
|
67
|
+
|
68
|
+
record1 = result[0].records[0]
|
69
|
+
|
70
|
+
assert_equal Time.parse('1970-01-01T00:00:10Z').to_datetime.rfc3339, record1.time
|
71
|
+
assert_equal 'mem', record1.measurement
|
72
|
+
assert_equal 10, record1.value
|
73
|
+
assert_equal 'free', record1.field
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'test_helper'
|
22
|
+
|
23
|
+
class WriteApiBatchingTest < MiniTest::Test
|
24
|
+
def setup
|
25
|
+
WebMock.disable_net_connect!
|
26
|
+
|
27
|
+
@write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
|
28
|
+
batch_size: 2, flush_interval: 5_000)
|
29
|
+
@client = InfluxDB2::Client.new('http://localhost:9999',
|
30
|
+
'my-token',
|
31
|
+
bucket: 'my-bucket',
|
32
|
+
org: 'my-org',
|
33
|
+
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
34
|
+
use_ssl: false)
|
35
|
+
|
36
|
+
@write_client = @client.create_write_api(write_options: @write_options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def teardown
|
40
|
+
@client.close!
|
41
|
+
|
42
|
+
assert_equal true, @write_client.closed
|
43
|
+
|
44
|
+
WebMock.reset!
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_batch_size
|
48
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
49
|
+
.to_return(status: 204)
|
50
|
+
|
51
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1')
|
52
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2')
|
53
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
54
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=4.0 4')
|
55
|
+
|
56
|
+
sleep(1)
|
57
|
+
|
58
|
+
request1 = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1\n" \
|
59
|
+
'h2o_feet,location=coyote_creek level\\ water_level=2.0 2'
|
60
|
+
request2 = "h2o_feet,location=coyote_creek level\\ water_level=3.0 3\n" \
|
61
|
+
'h2o_feet,location=coyote_creek level\\ water_level=4.0 4'
|
62
|
+
|
63
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
64
|
+
times: 1, body: request1)
|
65
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
66
|
+
times: 1, body: request2)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_batch_size_group_by
|
70
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
71
|
+
.to_return(status: 204)
|
72
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=s')
|
73
|
+
.to_return(status: 204)
|
74
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org-a&precision=ns')
|
75
|
+
.to_return(status: 204)
|
76
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket2&org=my-org-a&precision=ns')
|
77
|
+
.to_return(status: 204)
|
78
|
+
|
79
|
+
bucket = 'my-bucket'
|
80
|
+
bucket2 = 'my-bucket2'
|
81
|
+
org_a = 'my-org-a'
|
82
|
+
|
83
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1', bucket: bucket, org: 'my-org')
|
84
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2', bucket: bucket, org: 'my-org',
|
85
|
+
precision: InfluxDB2::WritePrecision::SECOND)
|
86
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3', bucket: bucket, org: org_a)
|
87
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=4.0 4', bucket: bucket, org: org_a)
|
88
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=5.0 5', bucket: bucket2, org: org_a)
|
89
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=6.0 6', bucket: bucket, org: org_a)
|
90
|
+
|
91
|
+
sleep(1)
|
92
|
+
|
93
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
94
|
+
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1')
|
95
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=s',
|
96
|
+
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2')
|
97
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org-a&precision=ns',
|
98
|
+
times: 1, body: "h2o_feet,location=coyote_creek level\\ water_level=3.0 3\n" \
|
99
|
+
'h2o_feet,location=coyote_creek level\\ water_level=4.0 4')
|
100
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket2&org=my-org-a&precision=ns',
|
101
|
+
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=5.0 5')
|
102
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org-a&precision=ns',
|
103
|
+
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=6.0 6')
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_flush_interval
|
107
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
108
|
+
.to_return(status: 204)
|
109
|
+
|
110
|
+
request1 = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1\n" \
|
111
|
+
'h2o_feet,location=coyote_creek level\\ water_level=2.0 2'
|
112
|
+
request2 = 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3'
|
113
|
+
|
114
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1')
|
115
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2')
|
116
|
+
|
117
|
+
sleep(1)
|
118
|
+
|
119
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
120
|
+
times: 1, body: request1)
|
121
|
+
|
122
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
123
|
+
|
124
|
+
sleep(2)
|
125
|
+
|
126
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
127
|
+
times: 0, body: request2)
|
128
|
+
|
129
|
+
sleep(3)
|
130
|
+
|
131
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
132
|
+
times: 1, body: request2)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_flush_all_by_close_client
|
136
|
+
stub_request(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
137
|
+
.to_return(status: 204)
|
138
|
+
|
139
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1')
|
140
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2')
|
141
|
+
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
142
|
+
|
143
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
144
|
+
times: 0, body: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
145
|
+
|
146
|
+
@client.close!
|
147
|
+
|
148
|
+
assert_requested(:post, 'http://localhost:9999/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
149
|
+
times: 1, body: "h2o_feet,location=coyote_creek level\\ water_level=1.0 1\n" \
|
150
|
+
"h2o_feet,location=coyote_creek level\\ water_level=2.0 2\n" \
|
151
|
+
'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
152
|
+
end
|
153
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0.pre.459
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Bednar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".circleci/config.yml"
|
133
133
|
- ".circleci/setup-rubygems.sh"
|
134
|
+
- ".codecov.yml"
|
134
135
|
- ".github/PULL_REQUEST_TEMPLATE"
|
135
136
|
- ".gitignore"
|
136
137
|
- ".rubocop.yml"
|
@@ -139,17 +140,32 @@ files:
|
|
139
140
|
- LICENSE
|
140
141
|
- README.md
|
141
142
|
- Rakefile
|
143
|
+
- bin/generate-sources.sh
|
142
144
|
- bin/influxdb-onboarding.sh
|
143
145
|
- bin/influxdb-restart.sh
|
146
|
+
- bin/pom.xml
|
147
|
+
- bin/swagger.yml
|
144
148
|
- influxdb-client.gemspec
|
145
149
|
- lib/influxdb2/client.rb
|
146
150
|
- lib/influxdb2/client/client.rb
|
151
|
+
- lib/influxdb2/client/default_api.rb
|
152
|
+
- lib/influxdb2/client/flux_csv_parser.rb
|
153
|
+
- lib/influxdb2/client/flux_table.rb
|
147
154
|
- lib/influxdb2/client/influx_error.rb
|
155
|
+
- lib/influxdb2/client/models/dialect.rb
|
156
|
+
- lib/influxdb2/client/models/query.rb
|
148
157
|
- lib/influxdb2/client/point.rb
|
158
|
+
- lib/influxdb2/client/query_api.rb
|
149
159
|
- lib/influxdb2/client/version.rb
|
160
|
+
- lib/influxdb2/client/worker.rb
|
150
161
|
- lib/influxdb2/client/write_api.rb
|
151
162
|
- test/influxdb/client_test.rb
|
163
|
+
- test/influxdb/flux_csv_parser_test.rb
|
152
164
|
- test/influxdb/point_test.rb
|
165
|
+
- test/influxdb/query_api_integration_test.rb
|
166
|
+
- test/influxdb/query_api_stream_test.rb
|
167
|
+
- test/influxdb/query_api_test.rb
|
168
|
+
- test/influxdb/write_api_batching_test.rb
|
153
169
|
- test/influxdb/write_api_integration_test.rb
|
154
170
|
- test/influxdb/write_api_test.rb
|
155
171
|
- test/test_helper.rb
|
@@ -181,7 +197,12 @@ specification_version: 4
|
|
181
197
|
summary: Ruby library for InfluxDB 2.
|
182
198
|
test_files:
|
183
199
|
- test/influxdb/client_test.rb
|
200
|
+
- test/influxdb/flux_csv_parser_test.rb
|
184
201
|
- test/influxdb/point_test.rb
|
202
|
+
- test/influxdb/query_api_integration_test.rb
|
203
|
+
- test/influxdb/query_api_stream_test.rb
|
204
|
+
- test/influxdb/query_api_test.rb
|
205
|
+
- test/influxdb/write_api_batching_test.rb
|
185
206
|
- test/influxdb/write_api_integration_test.rb
|
186
207
|
- test/influxdb/write_api_test.rb
|
187
208
|
- test/test_helper.rb
|