influxdb-client 2.0.0.pre.3196 → 2.1.0.pre.3441

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33f286d2a281bd72623ee0284de96e20aebfc433a39642478c43f31d0258ee50
4
- data.tar.gz: 98d9e3ddc4d6e892daa5bfeba7601af15e4c4da0440ad1ea8fa0d7740e38e21a
3
+ metadata.gz: 8bd4863b65a77e9132d6e1592907cc2ed74cdc66de156ac474d7ff12955814e6
4
+ data.tar.gz: c3fece1432f2d88abd392a52b3ff7315e5054c21c0f765e18799e5937c183bde
5
5
  SHA512:
6
- metadata.gz: f2f655f21aa5f143abc469b653a90bc9ca381371ad4c60d2bf35fc7019e0e1b6f8ce3d4403f30acaff03a134b0d31bc42c7001dc893dd5db9ad7d08b705dbfbc
7
- data.tar.gz: 95f5b211418be1dd31067dd7f266cbb2a57dc8736e66147908ae6c5edf48036ed021ae299915b04c3d19783d1962f487623f01881bceb27dba08f8d60696170e
6
+ metadata.gz: 49e160aaa1e8fbb689f83bb7d2f8f495b51adea1a90f8de05da2d3243ed68c4097ed3a3c61f53520f208e61e1eccab78cb42593834fd31dc5d43ed65b4756119
7
+ data.tar.gz: de77bfe938248e8a7963c6d5fc5b48f31c1833baf50f291f5c30128919852692c635a74b7785245eae375320d192f1188efb9135813b2a7bd9b429990bc0bcb3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- ## 2.0.0 [unreleased]
1
+ ## 2.1.0 [unreleased]
2
+
3
+ ### CI
4
+ 1. [#91](https://github.com/influxdata/influxdb-client-ruby/pull/91): Switch to next-gen CircleCI's convenience images
5
+
6
+ ## 2.0.0 [2021-09-13]
7
+
8
+ ### Bug Fixes
9
+ 1. [#90](https://github.com/influxdata/influxdb-client-ruby/pull/90): Fix parse text plain 503 error response
10
+ 1. [#89](https://github.com/influxdata/influxdb-client-ruby/pull/89): Correct redirect location
2
11
 
3
12
  ### Breaking Changes
4
13
  Due to a security reason `Authorization` header is not forwarded when redirect leads to a different domain.
@@ -6,9 +15,6 @@ To overcome this limitation you have to set the client property `redirect_forwar
6
15
 
7
16
  ### Features
8
17
  1. [#89](https://github.com/influxdata/influxdb-client-ruby/pull/89): `Authorization` header is not forwarded when redirect leads to a different domain
9
-
10
- ### Bug Fixes
11
- 1. [#89](https://github.com/influxdata/influxdb-client-ruby/pull/89): Correct redirect location
12
18
 
13
19
  ## 1.17.0 [2021-08-20]
14
20
 
data/README.md CHANGED
@@ -64,13 +64,13 @@ The client can be installed manually or with bundler.
64
64
  To install the client gem manually:
65
65
 
66
66
  ```
67
- gem install influxdb-client -v 1.17.0
67
+ gem install influxdb-client -v 2.0.0
68
68
  ```
69
69
 
70
70
  For management API:
71
71
 
72
72
  ```
73
- gem install influxdb-client-apis -v 1.17.0
73
+ gem install influxdb-client-apis -v 2.0.0
74
74
  ```
75
75
 
76
76
  ## Usage
@@ -35,6 +35,9 @@ module InfluxDB2
35
35
  obj = new(message: json['message'] || '', code: response.code, reference: json['code'] || '',
36
36
  retry_after: response['Retry-After'] || '')
37
37
  obj
38
+ rescue JSON::ParserError
39
+ new(message: response.body || '', code: response.code, reference: '',
40
+ retry_after: response['Retry-After'] || '')
38
41
  end
39
42
 
40
43
  def self.from_message(message)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '2.0.0'.freeze
22
+ VERSION = '2.1.0'.freeze
23
23
  end
@@ -210,11 +210,6 @@ class WriteApiBatchingTest < MiniTest::Test
210
210
  @write_client.write(data: ['h2o_feet,location=coyote_creek water_level=1.0 1',
211
211
  'h2o_feet,location=coyote_creek water_level=2.0 2'])
212
212
 
213
- sleep(0.05)
214
-
215
- assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
216
- times: 0, body: request)
217
-
218
213
  sleep(2)
219
214
 
220
215
  assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
@@ -617,4 +612,28 @@ class WriteApiRetryStrategyTest < MiniTest::Test
617
612
  assert_gte backoff, 1_600
618
613
  assert_lte backoff, 2_000
619
614
  end
615
+
616
+ def test_write_error_plain_retry
617
+ error_body = 'Service Unavailable'
618
+ stub_request(:any, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
619
+ .to_return(status: 503, headers: { 'content-type' => 'text/plain', 'Retry-After' => '2' }, body: error_body)
620
+ .to_return(status: 503, headers: { 'content-type' => 'text/plain' }, body: error_body).to_return(status: 204)
621
+
622
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
623
+ bucket: 'my-bucket',
624
+ org: 'my-org',
625
+ precision: InfluxDB2::WritePrecision::NANOSECOND,
626
+ use_ssl: false)
627
+
628
+ @write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
629
+ batch_size: 1, flush_interval: 1_000, retry_interval: 1_000)
630
+
631
+ write_api = client.create_write_api(write_options: @write_options)
632
+ request = 'h2o,location=west value=33i 15'
633
+ write_api.write(data: request)
634
+
635
+ sleep(10)
636
+ assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
637
+ times: 3, body: request)
638
+ end
620
639
  end
@@ -384,4 +384,25 @@ class WriteApiDefaultTagsTest < MiniTest::Test
384
384
  assert_requested(:post, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns',
385
385
  times: 1, body: expected)
386
386
  end
387
+
388
+ def test_write_error_plain
389
+ error_body = 'Service Unavailable'
390
+ stub_request(:any, 'http://localhost:8086/api/v2/write?bucket=my-bucket&org=my-org&precision=ns')
391
+ .to_return(status: 503, headers: { 'content-type' => 'text/plain' },
392
+ body: error_body)
393
+
394
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
395
+ bucket: 'my-bucket',
396
+ org: 'my-org',
397
+ precision: InfluxDB2::WritePrecision::NANOSECOND,
398
+ use_ssl: false)
399
+
400
+ error = assert_raises InfluxDB2::InfluxError do
401
+ write_api = client.create_write_api
402
+ write_api.write(data: 'h2o,location=west value=33i 15')
403
+ end
404
+
405
+ assert_equal '503', error.code
406
+ assert_equal 'Service Unavailable', error.message
407
+ end
387
408
  end
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: 2.0.0.pre.3196
4
+ version: 2.1.0.pre.3441
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2021-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  - !ruby/object:Gem::Version
189
189
  version: 1.3.1
190
190
  requirements: []
191
- rubygems_version: 3.0.3.1
191
+ rubygems_version: 3.2.22
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Ruby library for InfluxDB 2.