influxdb-client 1.8.0.pre.1133 → 1.8.0.pre.1218
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/config.yml +2 -5
- data/CHANGELOG.md +6 -0
- data/README.md +43 -13
- data/bin/influxdb-onboarding.sh +2 -2
- data/bin/influxdb-restart.sh +2 -1
- data/lib/influxdb2/client/client.rb +5 -4
- data/lib/influxdb2/client/point.rb +1 -1
- data/lib/influxdb2/client/write_api.rb +51 -1
- data/test/influxdb/client_test.rb +10 -10
- data/test/influxdb/delete_api_integration_test.rb +5 -1
- data/test/influxdb/delete_api_test.rb +15 -15
- data/test/influxdb/query_api_integration_test.rb +1 -1
- data/test/influxdb/query_api_stream_test.rb +1 -1
- data/test/influxdb/query_api_test.rb +7 -7
- data/test/influxdb/write_api_batching_test.rb +62 -62
- data/test/influxdb/write_api_integration_test.rb +2 -2
- data/test/influxdb/write_api_test.rb +135 -38
- metadata +2 -2
@@ -24,7 +24,7 @@ class QueryApiIntegrationTest < MiniTest::Test
|
|
24
24
|
def setup
|
25
25
|
WebMock.allow_net_connect!
|
26
26
|
|
27
|
-
@client = InfluxDB2::Client.new('http://localhost:
|
27
|
+
@client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
28
28
|
bucket: 'my-bucket',
|
29
29
|
org: 'my-org',
|
30
30
|
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
@@ -24,7 +24,7 @@ class QueryApiStreamTest < MiniTest::Test
|
|
24
24
|
def setup
|
25
25
|
WebMock.allow_net_connect!
|
26
26
|
|
27
|
-
@client = InfluxDB2::Client.new('http://localhost:
|
27
|
+
@client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
28
28
|
bucket: 'my-bucket',
|
29
29
|
org: 'my-org',
|
30
30
|
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
@@ -35,9 +35,9 @@ class QueryApiTest < MiniTest::Test
|
|
35
35
|
',,0,1970-01-01T00:00:20Z,1970-01-01T00:00:30Z,1970-01-01T00:00:20Z,22,free,mem,B,west'
|
36
36
|
|
37
37
|
def test_query_raw
|
38
|
-
stub_request(:post, 'http://localhost:
|
38
|
+
stub_request(:post, 'http://localhost:8086/api/v2/query?org=my-org')
|
39
39
|
.to_return(body: SUCCESS_DATA)
|
40
|
-
client = InfluxDB2::Client.new('http://localhost:
|
40
|
+
client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
41
41
|
bucket: 'my-bucket',
|
42
42
|
org: 'my-org',
|
43
43
|
use_ssl: false)
|
@@ -50,10 +50,10 @@ class QueryApiTest < MiniTest::Test
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_query
|
53
|
-
stub_request(:post, 'http://localhost:
|
53
|
+
stub_request(:post, 'http://localhost:8086/api/v2/query?org=my-org')
|
54
54
|
.to_return(body: SUCCESS_DATA)
|
55
55
|
|
56
|
-
client = InfluxDB2::Client.new('http://localhost:
|
56
|
+
client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
57
57
|
bucket: 'my-bucket',
|
58
58
|
org: 'my-org',
|
59
59
|
use_ssl: false)
|
@@ -74,10 +74,10 @@ class QueryApiTest < MiniTest::Test
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def test_headers
|
77
|
-
stub_request(:post, 'http://localhost:
|
77
|
+
stub_request(:post, 'http://localhost:8086/api/v2/query?org=my-org')
|
78
78
|
.to_return(body: SUCCESS_DATA)
|
79
79
|
|
80
|
-
client = InfluxDB2::Client.new('http://localhost:
|
80
|
+
client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
|
81
81
|
bucket: 'my-bucket',
|
82
82
|
org: 'my-org',
|
83
83
|
use_ssl: false)
|
@@ -90,7 +90,7 @@ class QueryApiTest < MiniTest::Test
|
|
90
90
|
'User-Agent' => "influxdb-client-ruby/#{InfluxDB2::VERSION}",
|
91
91
|
'Content-Type' => 'application/json'
|
92
92
|
}
|
93
|
-
assert_requested(:post, 'http://localhost:
|
93
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/query?org=my-org',
|
94
94
|
times: 1, headers: headers)
|
95
95
|
end
|
96
96
|
end
|
@@ -26,7 +26,7 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
26
26
|
|
27
27
|
@write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
|
28
28
|
batch_size: 2, flush_interval: 5_000, retry_interval: 2_000)
|
29
|
-
@client = InfluxDB2::Client.new('http://localhost:
|
29
|
+
@client = InfluxDB2::Client.new('http://localhost:8086',
|
30
30
|
'my-token',
|
31
31
|
bucket: 'my-bucket',
|
32
32
|
org: 'my-org',
|
@@ -68,7 +68,7 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_batch_size
|
71
|
-
stub_request(:post, 'http://localhost:
|
71
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
72
72
|
.to_return(status: 204)
|
73
73
|
|
74
74
|
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1')
|
@@ -83,20 +83,20 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
83
83
|
request2 = "h2o_feet,location=coyote_creek level\\ water_level=3.0 3\n" \
|
84
84
|
'h2o_feet,location=coyote_creek level\\ water_level=4.0 4'
|
85
85
|
|
86
|
-
assert_requested(:post, 'http://localhost:
|
86
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
87
87
|
times: 1, body: request1)
|
88
|
-
assert_requested(:post, 'http://localhost:
|
88
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
89
89
|
times: 1, body: request2)
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_batch_size_group_by
|
93
|
-
stub_request(:post, 'http://localhost:
|
93
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
94
94
|
.to_return(status: 204)
|
95
|
-
stub_request(:post, 'http://localhost:
|
95
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=s')
|
96
96
|
.to_return(status: 204)
|
97
|
-
stub_request(:post, 'http://localhost:
|
97
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org-a&precision=ns')
|
98
98
|
.to_return(status: 204)
|
99
|
-
stub_request(:post, 'http://localhost:
|
99
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket2&org=my-org-a&precision=ns')
|
100
100
|
.to_return(status: 204)
|
101
101
|
|
102
102
|
bucket = 'my-bucket'
|
@@ -113,21 +113,21 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
113
113
|
|
114
114
|
sleep(1)
|
115
115
|
|
116
|
-
assert_requested(:post, 'http://localhost:
|
116
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
117
117
|
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1')
|
118
|
-
assert_requested(:post, 'http://localhost:
|
118
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=s',
|
119
119
|
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2')
|
120
|
-
assert_requested(:post, 'http://localhost:
|
120
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org-a&precision=ns',
|
121
121
|
times: 1, body: "h2o_feet,location=coyote_creek level\\ water_level=3.0 3\n" \
|
122
122
|
'h2o_feet,location=coyote_creek level\\ water_level=4.0 4')
|
123
|
-
assert_requested(:post, 'http://localhost:
|
123
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket2&org=my-org-a&precision=ns',
|
124
124
|
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=5.0 5')
|
125
|
-
assert_requested(:post, 'http://localhost:
|
125
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org-a&precision=ns',
|
126
126
|
times: 1, body: 'h2o_feet,location=coyote_creek level\\ water_level=6.0 6')
|
127
127
|
end
|
128
128
|
|
129
129
|
def test_flush_interval
|
130
|
-
stub_request(:post, 'http://localhost:
|
130
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
131
131
|
.to_return(status: 204)
|
132
132
|
|
133
133
|
request1 = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1\n" \
|
@@ -139,31 +139,31 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
139
139
|
|
140
140
|
sleep(1)
|
141
141
|
|
142
|
-
assert_requested(:post, 'http://localhost:
|
142
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
143
143
|
times: 1, body: request1)
|
144
144
|
|
145
145
|
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
146
146
|
|
147
147
|
sleep(2)
|
148
148
|
|
149
|
-
assert_requested(:post, 'http://localhost:
|
149
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
150
150
|
times: 0, body: request2)
|
151
151
|
|
152
152
|
sleep(3)
|
153
153
|
|
154
|
-
assert_requested(:post, 'http://localhost:
|
154
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
155
155
|
times: 1, body: request2)
|
156
156
|
end
|
157
157
|
|
158
158
|
def test_flush_all_by_close_client
|
159
|
-
stub_request(:post, 'http://localhost:
|
159
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
160
160
|
.to_return(status: 204)
|
161
161
|
|
162
162
|
@client.close!
|
163
163
|
|
164
164
|
@write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
|
165
165
|
batch_size: 10, flush_interval: 5_000)
|
166
|
-
@client = InfluxDB2::Client.new('http://localhost:
|
166
|
+
@client = InfluxDB2::Client.new('http://localhost:8086',
|
167
167
|
'my-token',
|
168
168
|
bucket: 'my-bucket',
|
169
169
|
org: 'my-org',
|
@@ -176,12 +176,12 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
176
176
|
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=2.0 2')
|
177
177
|
@write_client.write(data: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
178
178
|
|
179
|
-
assert_requested(:post, 'http://localhost:
|
179
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
180
180
|
times: 0, body: 'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
181
181
|
|
182
182
|
@client.close!
|
183
183
|
|
184
|
-
assert_requested(:post, 'http://localhost:
|
184
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
185
185
|
times: 1, body: "h2o_feet,location=coyote_creek level\\ water_level=1.0 1\n" \
|
186
186
|
"h2o_feet,location=coyote_creek level\\ water_level=2.0 2\n" \
|
187
187
|
'h2o_feet,location=coyote_creek level\\ water_level=3.0 3')
|
@@ -190,7 +190,7 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
190
190
|
def test_jitter_interval
|
191
191
|
@client.close!
|
192
192
|
|
193
|
-
@client = InfluxDB2::Client.new('http://localhost:
|
193
|
+
@client = InfluxDB2::Client.new('http://localhost:8086',
|
194
194
|
'my-token',
|
195
195
|
bucket: 'my-bucket',
|
196
196
|
org: 'my-org',
|
@@ -201,7 +201,7 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
201
201
|
batch_size: 2, flush_interval: 5_000, jitter_interval: 2_000)
|
202
202
|
@write_client = @client.create_write_api(write_options: @write_options)
|
203
203
|
|
204
|
-
stub_request(:post, 'http://localhost:
|
204
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
205
205
|
.to_return(status: 204)
|
206
206
|
|
207
207
|
request = "h2o_feet,location=coyote_creek water_level=1.0 1\n" \
|
@@ -212,12 +212,12 @@ class WriteApiBatchingTest < MiniTest::Test
|
|
212
212
|
|
213
213
|
sleep(0.05)
|
214
214
|
|
215
|
-
assert_requested(:post, 'http://localhost:
|
215
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
216
216
|
times: 0, body: request)
|
217
217
|
|
218
218
|
sleep(2)
|
219
219
|
|
220
|
-
assert_requested(:post, 'http://localhost:
|
220
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
221
221
|
times: 1, body: request)
|
222
222
|
end
|
223
223
|
end
|
@@ -228,7 +228,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
228
228
|
|
229
229
|
@write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
|
230
230
|
batch_size: 2, flush_interval: 5_000, retry_interval: 2_000)
|
231
|
-
@client = InfluxDB2::Client.new('http://localhost:
|
231
|
+
@client = InfluxDB2::Client.new('http://localhost:8086',
|
232
232
|
'my-token',
|
233
233
|
bucket: 'my-bucket',
|
234
234
|
org: 'my-org',
|
@@ -250,7 +250,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
250
250
|
error_body = '{"code":"temporarily unavailable","message":"Token is temporarily over quota. '\
|
251
251
|
'The Retry-After header describes when to try the write again."}'
|
252
252
|
|
253
|
-
stub_request(:post, 'http://localhost:
|
253
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
254
254
|
.to_return(status: 429, headers: { 'X-Platform-Error-Code' => 'temporarily unavailable' }, body: error_body).then
|
255
255
|
.to_return(status: 204)
|
256
256
|
|
@@ -262,17 +262,17 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
262
262
|
|
263
263
|
sleep(0.5)
|
264
264
|
|
265
|
-
assert_requested(:post, 'http://localhost:
|
265
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
266
266
|
times: 1, body: request)
|
267
267
|
|
268
268
|
sleep(1)
|
269
269
|
|
270
|
-
assert_requested(:post, 'http://localhost:
|
270
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
271
271
|
times: 1, body: request)
|
272
272
|
|
273
273
|
sleep(5)
|
274
274
|
|
275
|
-
assert_requested(:post, 'http://localhost:
|
275
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
276
276
|
times: 2, body: request)
|
277
277
|
end
|
278
278
|
|
@@ -280,7 +280,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
280
280
|
error_body = '{"code":"temporarily unavailable","message":"Server is temporarily unavailable to accept writes. '\
|
281
281
|
'The Retry-After header describes when to try the write again."}'
|
282
282
|
|
283
|
-
stub_request(:post, 'http://localhost:
|
283
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
284
284
|
.to_return(status: 503, headers: { 'X-Platform-Error-Code' => 'temporarily unavailable', 'Retry-After' => '3' },
|
285
285
|
body: error_body).then
|
286
286
|
.to_return(status: 204)
|
@@ -296,22 +296,22 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
296
296
|
|
297
297
|
sleep(0.5)
|
298
298
|
|
299
|
-
assert_requested(:post, 'http://localhost:
|
299
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
300
300
|
times: 1, body: request)
|
301
301
|
|
302
302
|
sleep(1)
|
303
303
|
|
304
|
-
assert_requested(:post, 'http://localhost:
|
304
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
305
305
|
times: 1, body: request)
|
306
306
|
|
307
307
|
sleep(1)
|
308
308
|
|
309
|
-
assert_requested(:post, 'http://localhost:
|
309
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
310
310
|
times: 1, body: request)
|
311
311
|
|
312
312
|
sleep(1)
|
313
313
|
|
314
|
-
assert_requested(:post, 'http://localhost:
|
314
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
315
315
|
times: 2, body: request)
|
316
316
|
end
|
317
317
|
|
@@ -321,7 +321,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
321
321
|
|
322
322
|
headers = { 'X-Platform-Error-Code' => 'temporarily unavailable' }
|
323
323
|
|
324
|
-
stub_request(:post, 'http://localhost:
|
324
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
325
325
|
.to_return(status: 429, headers: headers, body: error_body).then # retry
|
326
326
|
.to_return(status: 429, headers: headers, body: error_body).then # retry
|
327
327
|
.to_return(status: 429, headers: headers, body: error_body).then # retry
|
@@ -343,27 +343,27 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
343
343
|
|
344
344
|
sleep(0.5)
|
345
345
|
|
346
|
-
assert_requested(:post, 'http://localhost:
|
346
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
347
347
|
times: 1, body: request)
|
348
348
|
|
349
349
|
sleep(2)
|
350
350
|
|
351
|
-
assert_requested(:post, 'http://localhost:
|
351
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
352
352
|
times: 2, body: request)
|
353
353
|
|
354
354
|
sleep(4)
|
355
355
|
|
356
|
-
assert_requested(:post, 'http://localhost:
|
356
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
357
357
|
times: 3, body: request)
|
358
358
|
|
359
359
|
sleep(5)
|
360
360
|
|
361
|
-
assert_requested(:post, 'http://localhost:
|
361
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
362
362
|
times: 4, body: request)
|
363
363
|
|
364
364
|
sleep(5)
|
365
365
|
|
366
|
-
assert_requested(:post, 'http://localhost:
|
366
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
367
367
|
times: 4, body: request)
|
368
368
|
|
369
369
|
sleep(5)
|
@@ -371,7 +371,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
371
371
|
|
372
372
|
assert_equal('429', error.code)
|
373
373
|
|
374
|
-
assert_requested(:post, 'http://localhost:
|
374
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
375
375
|
times: 4, body: request)
|
376
376
|
end
|
377
377
|
|
@@ -379,7 +379,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
379
379
|
error_body = '{"code":"invalid","message":"unable to parse '\
|
380
380
|
'\'h2o_feet, location=coyote_creek water_level=1.0 1\': missing tag key"}'
|
381
381
|
|
382
|
-
stub_request(:any, 'http://localhost:
|
382
|
+
stub_request(:any, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
383
383
|
.to_return(status: 400, headers: { 'X-Platform-Error-Code' => 'invalid' }, body: error_body)
|
384
384
|
|
385
385
|
write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
|
@@ -403,7 +403,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
403
403
|
|
404
404
|
headers = { 'X-Platform-Error-Code' => 'temporarily unavailable', 'Retry-After' => '3' }
|
405
405
|
|
406
|
-
stub_request(:post, 'http://localhost:
|
406
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
407
407
|
.to_return(status: 429, headers: headers, body: error_body).then # retry
|
408
408
|
.to_return(status: 429, headers: headers, body: error_body).then # retry
|
409
409
|
.to_return(status: 429, headers: headers, body: error_body).then # retry
|
@@ -425,22 +425,22 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
425
425
|
|
426
426
|
sleep(0.5)
|
427
427
|
|
428
|
-
assert_requested(:post, 'http://localhost:
|
428
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
429
429
|
times: 1, body: request)
|
430
430
|
|
431
431
|
sleep(3)
|
432
432
|
|
433
|
-
assert_requested(:post, 'http://localhost:
|
433
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
434
434
|
times: 2, body: request)
|
435
435
|
|
436
436
|
sleep(3)
|
437
437
|
|
438
|
-
assert_requested(:post, 'http://localhost:
|
438
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
439
439
|
times: 3, body: request)
|
440
440
|
|
441
441
|
sleep(3)
|
442
442
|
|
443
|
-
assert_requested(:post, 'http://localhost:
|
443
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
444
444
|
times: 4, body: request)
|
445
445
|
|
446
446
|
sleep(3)
|
@@ -448,15 +448,15 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
448
448
|
|
449
449
|
assert_equal('429', error.code)
|
450
450
|
|
451
|
-
assert_requested(:post, 'http://localhost:
|
451
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
452
452
|
times: 4, body: request)
|
453
453
|
end
|
454
454
|
|
455
455
|
def test_connection_error
|
456
|
-
error_message = 'Failed to open TCP connection to localhost:
|
457
|
-
'(Connection refused - connect(2) for "localhost" port
|
456
|
+
error_message = 'Failed to open TCP connection to localhost:8086' \
|
457
|
+
'(Connection refused - connect(2) for "localhost" port 8086)'
|
458
458
|
|
459
|
-
stub_request(:post, 'http://localhost:
|
459
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
460
460
|
.to_raise(Errno::ECONNREFUSED.new(error_message))
|
461
461
|
.to_raise(Errno::ECONNREFUSED.new(error_message))
|
462
462
|
.to_raise(Errno::ECONNREFUSED.new(error_message))
|
@@ -478,27 +478,27 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
478
478
|
|
479
479
|
sleep(0.5)
|
480
480
|
|
481
|
-
assert_requested(:post, 'http://localhost:
|
481
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
482
482
|
times: 1, body: request)
|
483
483
|
|
484
484
|
sleep(2)
|
485
485
|
|
486
|
-
assert_requested(:post, 'http://localhost:
|
486
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
487
487
|
times: 2, body: request)
|
488
488
|
|
489
489
|
sleep(4)
|
490
490
|
|
491
|
-
assert_requested(:post, 'http://localhost:
|
491
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
492
492
|
times: 3, body: request)
|
493
493
|
|
494
494
|
sleep(5)
|
495
495
|
|
496
|
-
assert_requested(:post, 'http://localhost:
|
496
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
497
497
|
times: 4, body: request)
|
498
498
|
|
499
499
|
sleep(5)
|
500
500
|
|
501
|
-
assert_requested(:post, 'http://localhost:
|
501
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
502
502
|
times: 4, body: request)
|
503
503
|
|
504
504
|
sleep(5)
|
@@ -508,7 +508,7 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
508
508
|
end
|
509
509
|
|
510
510
|
def test_write_connection_error
|
511
|
-
stub_request(:post, 'http://localhost:
|
511
|
+
stub_request(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
|
512
512
|
.to_raise(Errno::ECONNREFUSED.new(''))
|
513
513
|
.to_raise(Errno::ECONNREFUSED.new(''))
|
514
514
|
.to_return(status: 204)
|
@@ -527,22 +527,22 @@ class WriteApiRetryStrategyTest < MiniTest::Test
|
|
527
527
|
|
528
528
|
sleep(0.5)
|
529
529
|
|
530
|
-
assert_requested(:post, 'http://localhost:
|
530
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
531
531
|
times: 1, body: request)
|
532
532
|
|
533
533
|
sleep(2)
|
534
534
|
|
535
|
-
assert_requested(:post, 'http://localhost:
|
535
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
536
536
|
times: 2, body: request)
|
537
537
|
|
538
538
|
sleep(4)
|
539
539
|
|
540
|
-
assert_requested(:post, 'http://localhost:
|
540
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
541
541
|
times: 3, body: request)
|
542
542
|
|
543
543
|
sleep(5)
|
544
544
|
|
545
|
-
assert_requested(:post, 'http://localhost:
|
545
|
+
assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
|
546
546
|
times: 3, body: request)
|
547
547
|
end
|
548
548
|
end
|