influxdb-client 1.8.0.pre.1133 → 1.8.0.pre.1218

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4410945b13b498445388cf28f622a1179c3b3462bf9c78f88520bb8f110b9d89
4
- data.tar.gz: 35b2c199c0e23a0c2393ebe23ea05e51f4bc08603259cfb65e3483f60d0ca638
3
+ metadata.gz: 83e17817aa71b99fc2c00c9810031c7a1acbf86e3560b91e1ad277f0213ddd66
4
+ data.tar.gz: d58024ec56f0766126c06b829a49dce98ff83f85dda23990f0cd05d9f9917fc1
5
5
  SHA512:
6
- metadata.gz: 68f297df3d302f5c3c82aa178212ee36238d594e8fd53ef61a2943a249685ec783182129f6f3f82638bb402d4550d32d5912e45354b86e9c3a8dfd4f6e65b1a7
7
- data.tar.gz: da636037b8e41218f1a24ac339a781a8c812124cd7c190bbd85ef2c805f519725e51dec5529d55024d1340c1b1fef857e9fbb55ec0ac66f83f7ceaa8659bcec1
6
+ metadata.gz: 40fede72bad180624c088af3ee92f005ff2dfc357e330012f17b06284b939f8017c018b79bb36e3112a646361b57f492c8d7e45bb402b657ece43796657b7fe4
7
+ data.tar.gz: a1636a76698949e303c749fdcc2936faa31928d140baac04d0449fc1248afbf9c1b4fa2ff427dadd20932ffed512311abad7d682328caf96e39a68f19c096947
@@ -82,6 +82,8 @@ jobs:
82
82
  docker:
83
83
  - image: << parameters.ruby-image >>
84
84
  - image: &influx-image quay.io/influxdb/<< parameters.influxdb-image >>
85
+ environment:
86
+ INFLUXD_HTTP_BIND_ADDRESS: :8086
85
87
  steps:
86
88
  - prepare
87
89
  - test:
@@ -89,13 +91,8 @@ jobs:
89
91
  - storing-test-results
90
92
 
91
93
  deploy-preview:
92
- parameters:
93
- influxdb-image:
94
- type: string
95
- default: *default-influxdb-image
96
94
  docker:
97
95
  - image: *default-ruby-image
98
- - image: *influx-image
99
96
  steps:
100
97
  - run:
101
98
  name: Early return if this build is from a forked repository
@@ -1,5 +1,11 @@
1
1
  ## 1.8.0 [unreleased]
2
2
 
3
+ ### Features
4
+ 1. [#36](https://github.com/influxdata/influxdb-client-ruby/issues/36): Added support for default tags
5
+
6
+ ### API
7
+ 1. [#50](https://github.com/influxdata/influxdb-client-ruby/pull/50): Default port changed from 9999 -> 8086
8
+
3
9
  ## 1.7.0 [2020-08-14]
4
10
 
5
11
  ### Features
data/README.md CHANGED
@@ -33,7 +33,7 @@ gem install influxdb-client -v 1.7.0
33
33
  Use **InfluxDB::Client** to create a client connected to a running InfluxDB 2 instance.
34
34
 
35
35
  ```ruby
36
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token')
36
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token')
37
37
  ```
38
38
 
39
39
  #### Client Options
@@ -50,7 +50,7 @@ client = InfluxDB2::Client.new('https://localhost:9999', 'my-token')
50
50
  | use_ssl | Turn on/off SSL for HTTP communication | bool | true |
51
51
 
52
52
  ```ruby
53
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
53
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
54
54
  bucket: 'my-bucket',
55
55
  org: 'my-org',
56
56
  precision: InfluxDB2::WritePrecision::NANOSECOND)
@@ -68,7 +68,7 @@ The result retrieved by [QueryApi](https://github.com/influxdata/influxdb-client
68
68
 
69
69
  Synchronously executes the Flux query and return result as unprocessed String
70
70
  ```ruby
71
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
71
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
72
72
  bucket: 'my-bucket',
73
73
  org: 'my-org')
74
74
 
@@ -78,7 +78,7 @@ result = query_api.query_raw(query: 'from(bucket:"' + bucket + '") |> range(star
78
78
  #### Synchronous query
79
79
  Synchronously executes the Flux query and return result as a Array of [FluxTables](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/flux_table.rb)
80
80
  ```ruby
81
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
81
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
82
82
  bucket: 'my-bucket',
83
83
  org: 'my-org')
84
84
 
@@ -89,7 +89,7 @@ result = query_api.query(query: 'from(bucket:"' + bucket + '") |> range(start: 1
89
89
  #### Query stream
90
90
  Synchronously executes the Flux query and return stream of [FluxRecord](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/flux_table.rb)
91
91
  ```ruby
92
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
92
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
93
93
  bucket: 'my-bucket',
94
94
  org: 'my-org')
95
95
 
@@ -107,7 +107,7 @@ end
107
107
  The [WriteApi](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/write_api.rb) supports synchronous and batching writes into InfluxDB 2.0. In default api uses synchronous write. To enable batching you can use WriteOption.
108
108
 
109
109
  ```ruby
110
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
110
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
111
111
  bucket: 'my-bucket',
112
112
  org: 'my-org',
113
113
  precision: InfluxDB2::WritePrecision::NANOSECOND)
@@ -133,7 +133,7 @@ write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BA
133
133
  batch_size: 10, flush_interval: 5_000,
134
134
  max_retries: 3, max_retry_delay: 15_000,
135
135
  exponential_base: 2)
136
- client = InfluxDB2::Client.new('http://localhost:9999',
136
+ client = InfluxDB2::Client.new('http://localhost:8086',
137
137
  'my-token',
138
138
  bucket: 'my-bucket',
139
139
  org: 'my-org',
@@ -148,7 +148,7 @@ write_api.write(data: 'h2o,location=west value=33i 15')
148
148
 
149
149
  Configure default time precision:
150
150
  ```ruby
151
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
151
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
152
152
  bucket: 'my-bucket',
153
153
  org: 'my-org',
154
154
  precision: InfluxDB2::WritePrecision::NANOSECOND)
@@ -156,7 +156,7 @@ client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
156
156
 
157
157
  Configure precision per write:
158
158
  ```ruby
159
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
159
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
160
160
  bucket: 'my-bucket',
161
161
  org: 'my-org')
162
162
 
@@ -173,7 +173,7 @@ Allowed values for precision are:
173
173
 
174
174
  Default `bucket` and `organization` destination are configured via `InfluxDB::Client`:
175
175
  ```ruby
176
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
176
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
177
177
  bucket: 'my-bucket',
178
178
  org: 'my-org')
179
179
  ```
@@ -181,7 +181,7 @@ client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
181
181
  but there is also possibility to override configuration per write:
182
182
 
183
183
  ```ruby
184
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token')
184
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token')
185
185
 
186
186
  write_api = client.create_write_api
187
187
  write_api.write(data: 'h2o,location=west value=33i 15', bucket: 'production-data', org: 'customer-1')
@@ -197,7 +197,7 @@ The data could be written as:
197
197
  1. `Array` of above items
198
198
 
199
199
  ```ruby
200
- client = InfluxDB2::Client.new('https://localhost:9999', 'my-token',
200
+ client = InfluxDB2::Client.new('https://localhost:8086', 'my-token',
201
201
  bucket: 'my-bucket',
202
202
  org: 'my-org',
203
203
  precision: InfluxDB2::WritePrecision::NANOSECOND)
@@ -214,12 +214,42 @@ write_api = client.create_write_api
214
214
  write_api.write(data: ['h2o,location=west value=33i 15', point, hash])
215
215
  ```
216
216
 
217
+ #### Default Tags
218
+
219
+ Sometimes is useful to store same information in every measurement e.g. `hostname`, `location`, `customer`.
220
+ The client is able to use static value, app settings or env variable as a tag value.
221
+
222
+ The expressions:
223
+ - `California Miner` - static value
224
+ - `${env.hostname}` - environment property
225
+
226
+ ##### Via API
227
+
228
+ ```ruby
229
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
230
+ bucket: 'my-bucket',
231
+ org: 'my-org',
232
+ precision: InfluxDB2::WritePrecision::NANOSECOND,
233
+ use_ssl: false,
234
+ tags: { id: '132-987-655' })
235
+
236
+ point_settings = InfluxDB2::PointSettings.new(default_tags: { customer: 'California Miner' })
237
+ point_settings.add_default_tag('data_center', '${env.data_center}')
238
+
239
+ write_api = client.create_write_api(write_options: InfluxDB2::SYNCHRONOUS,
240
+ point_settings: point_settings)
241
+
242
+ write_api.write(data: InfluxDB2::Point.new(name: 'h2o')
243
+ .add_tag('location', 'europe')
244
+ .add_field('level', 2))
245
+ ```
246
+
217
247
  ### Delete data
218
248
 
219
249
  The [DeleteApi](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/delete_api.rb) supports deletes [points](https://v2.docs.influxdata.com/v2.0/reference/glossary/#point) from an InfluxDB bucket.
220
250
 
221
251
  ```ruby
222
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
252
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
223
253
  bucket: 'my-bucket',
224
254
  org: 'my-org',
225
255
  precision: InfluxDB2::WritePrecision::NANOSECOND)
@@ -24,12 +24,12 @@
24
24
  set -e
25
25
 
26
26
  echo "Wait to start InfluxDB 2.0"
27
- wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics
27
+ wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:8086/metrics
28
28
 
29
29
  echo
30
30
  echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
31
31
  echo
32
- curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
32
+ curl -i -X POST http://localhost:8086/api/v2/setup -H 'accept: application/json' \
33
33
  -d '{
34
34
  "username": "my-user",
35
35
  "password": "my-password",
@@ -49,9 +49,10 @@ echo
49
49
  docker pull "${INFLUXDB_V2_IMAGE}" || true
50
50
  docker run \
51
51
  --detach \
52
+ --env INFLUXD_HTTP_BIND_ADDRESS=:8086 \
52
53
  --name influxdb_v2 \
53
54
  --network influx_network \
54
- --publish 9999:9999 \
55
+ --publish 8086:8086 \
55
56
  "${INFLUXDB_V2_IMAGE}"
56
57
 
57
58
  #
@@ -29,10 +29,10 @@ module InfluxDB2
29
29
  # Instantiate a new InfluxDB client.
30
30
  #
31
31
  # @example Instantiate a client.
32
- # InfluxDBClient::Client.new(url: 'https://localhost:9999', token: 'my-token')
32
+ # InfluxDBClient::Client.new(url: 'https://localhost:8086', token: 'my-token')
33
33
  #
34
34
  # @param [Hash] options The options to be used by the client.
35
- # @param [String] url InfluxDB URL to connect to (ex. https://localhost:9999).
35
+ # @param [String] url InfluxDB URL to connect to (ex. https://localhost:8086).
36
36
  # @param [String] token Access Token used for authenticating/authorizing the InfluxDB request sent by client.
37
37
  #
38
38
  # @option options [String] :bucket the default destination bucket for writes
@@ -43,6 +43,7 @@ module InfluxDB2
43
43
  # @option options [Integer] :read_timeout Number of seconds to wait for one block of data to be read
44
44
  # @option options [Integer] :max_redirect_count Maximal number of followed HTTP redirects
45
45
  # @option options [bool] :use_ssl Turn on/off SSL for HTTP communication
46
+ # @option options [Hash] :tags Default tags which will be added to each point written by api.
46
47
  # the body line-protocol
47
48
  def initialize(url, token, options = nil)
48
49
  @auto_closeable = []
@@ -57,8 +58,8 @@ module InfluxDB2
57
58
  # Write time series data into InfluxDB thought WriteApi.
58
59
  #
59
60
  # @return [WriteApi] New instance of WriteApi.
60
- def create_write_api(write_options: InfluxDB2::SYNCHRONOUS)
61
- write_api = WriteApi.new(options: @options, write_options: write_options)
61
+ def create_write_api(write_options: InfluxDB2::SYNCHRONOUS, point_settings: InfluxDB2::DEFAULT_POINT_SETTINGS)
62
+ write_api = WriteApi.new(options: @options, write_options: write_options, point_settings: point_settings)
62
63
  @auto_closeable.push(write_api)
63
64
  write_api
64
65
  end
@@ -138,7 +138,7 @@ module InfluxDB2
138
138
  def _escape_tags
139
139
  return if @tags.nil?
140
140
 
141
- @tags.sort.to_h.map do |k, v|
141
+ @tags.sort_by { |x, _| x.to_s }.to_h.map do |k, v|
142
142
  key = _escape_key(k.to_s)
143
143
  value = _escape_key(v.to_s)
144
144
  if key.empty? || value.empty?
@@ -72,6 +72,30 @@ module InfluxDB2
72
72
 
73
73
  SYNCHRONOUS = InfluxDB2::WriteOptions.new(write_type: WriteType::SYNCHRONOUS)
74
74
 
75
+ # Settings to store default tags.
76
+ #
77
+ class PointSettings
78
+ # @param [Hash] default_tags Default tags which will be added to each point written by api.
79
+ def initialize(default_tags: nil)
80
+ @default_tags = default_tags || {}
81
+ end
82
+ attr_reader :default_tags
83
+
84
+ def add_default_tag(key, expression)
85
+ @default_tags[key] = expression
86
+ end
87
+
88
+ def self.get_value(value)
89
+ if value.start_with?('${env.')
90
+ ENV[value[6..-2]]
91
+ else
92
+ value
93
+ end
94
+ end
95
+ end
96
+
97
+ DEFAULT_POINT_SETTINGS = InfluxDB2::PointSettings.new
98
+
75
99
  # Precision constants.
76
100
  #
77
101
  class WritePrecision
@@ -93,10 +117,13 @@ module InfluxDB2
93
117
  class WriteApi < DefaultApi
94
118
  # @param [Hash] options The options to be used by the client.
95
119
  # @param [WriteOptions] write_options Write api configuration.
96
- def initialize(options:, write_options: SYNCHRONOUS)
120
+ # @param [PointSettings] point_settings Default tags configuration
121
+ def initialize(options:, write_options: SYNCHRONOUS, point_settings: InfluxDB2::PointSettings.new)
97
122
  super(options: options)
98
123
  @write_options = write_options
124
+ @point_settings = point_settings
99
125
  @closed = false
126
+ @options[:tags].each { |key, value| point_settings.add_default_tag(key, value) } if @options.key?(:tags)
100
127
  end
101
128
  attr_reader :closed
102
129
 
@@ -140,6 +167,8 @@ module InfluxDB2
140
167
  _check('bucket', bucket_param)
141
168
  _check('org', org_param)
142
169
 
170
+ _add_default_tags(data)
171
+
143
172
  payload = _generate_payload(data, bucket: bucket_param, org: org_param, precision: precision_param)
144
173
  return nil if payload.nil?
145
174
 
@@ -223,6 +252,27 @@ module InfluxDB2
223
252
  end
224
253
  end
225
254
 
255
+ def _add_default_tags(data)
256
+ default_tags = @point_settings.default_tags
257
+
258
+ default_tags.each do |key, expression|
259
+ value = PointSettings.get_value(expression)
260
+ _add_default_tag(data, key, value)
261
+ end
262
+ end
263
+
264
+ def _add_default_tag(data, key, value)
265
+ if data.is_a?(Point)
266
+ data.add_tag(key, value)
267
+ elsif data.is_a?(Hash)
268
+ data[:tags][key] = value
269
+ elsif data.respond_to? :map
270
+ data.map do |item|
271
+ _add_default_tag(item, key, value)
272
+ end.reject(&:nil?)
273
+ end
274
+ end
275
+
226
276
  def _generate_payload(data, precision: nil, bucket: nil, org: nil)
227
277
  if data.nil?
228
278
  nil
@@ -30,41 +30,41 @@ class ClientTest < Minitest::Test
30
30
  end
31
31
 
32
32
  def test_client_new
33
- refute_nil InfluxDB2::Client.new('http://localhost:9999', 'my-token')
33
+ refute_nil InfluxDB2::Client.new('http://localhost:8086', 'my-token')
34
34
  end
35
35
 
36
36
  def test_client_hash
37
- client1 = InfluxDB2::Client.new('http://localhost:9999', 'my-token')
38
- client2 = InfluxDB2::Client.new('http://localhost:9999', 'my-token-diff')
37
+ client1 = InfluxDB2::Client.new('http://localhost:8086', 'my-token')
38
+ client2 = InfluxDB2::Client.new('http://localhost:8086', 'my-token-diff')
39
39
 
40
40
  refute_equal client1.hash, client2.hash
41
41
  assert_equal client1.hash, client1.hash
42
42
  end
43
43
 
44
44
  def test_client_eq
45
- client1 = InfluxDB2::Client.new('http://localhost:9999', 'my-token')
46
- client2 = InfluxDB2::Client.new('http://localhost:9999', 'my-token-diff')
45
+ client1 = InfluxDB2::Client.new('http://localhost:8086', 'my-token')
46
+ client2 = InfluxDB2::Client.new('http://localhost:8086', 'my-token-diff')
47
47
 
48
48
  refute_equal client1, client2
49
49
  assert_equal client1, client1
50
50
  end
51
51
 
52
52
  def test_client_options
53
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token')
53
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token')
54
54
 
55
- assert_equal 'http://localhost:9999', client.options[:url]
55
+ assert_equal 'http://localhost:8086', client.options[:url]
56
56
  assert_equal 'my-token', client.options[:token]
57
57
  end
58
58
 
59
59
  def test_close
60
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token')
60
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token')
61
61
 
62
62
  assert_equal true, client.close!
63
63
  assert_equal true, client.close!
64
64
  end
65
65
 
66
66
  def test_get_write_api
67
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token')
67
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token')
68
68
 
69
69
  write_api = client.create_write_api
70
70
 
@@ -73,7 +73,7 @@ class ClientTest < Minitest::Test
73
73
  end
74
74
 
75
75
  def test_health
76
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token', use_ssl: false)
76
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token', use_ssl: false)
77
77
 
78
78
  health = client.health
79
79
  assert_equal 'ready for queries and writes', health.message
@@ -24,7 +24,7 @@ class DeleteApiIntegrationTest < MiniTest::Test
24
24
  def setup
25
25
  WebMock.allow_net_connect!
26
26
 
27
- @client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
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,
@@ -56,6 +56,8 @@ class DeleteApiIntegrationTest < MiniTest::Test
56
56
  end
57
57
 
58
58
  def test_delete
59
+ # TODO: https://github.com/influxdata/influxdb/issues/19545
60
+ skip
59
61
  @client.create_delete_api.delete(Time.utc(2015, 10, 16, 8, 20, 15), Time.utc(2020, 10, 16, 8, 20, 15),
60
62
  predicate: 'location="europe"')
61
63
 
@@ -63,6 +65,8 @@ class DeleteApiIntegrationTest < MiniTest::Test
63
65
  end
64
66
 
65
67
  def test_delete_without_predicate
68
+ # TODO: https://github.com/influxdata/influxdb/issues/19545
69
+ skip
66
70
  @client.create_delete_api.delete(Time.utc(2016, 10, 15, 7, 20, 15), Time.utc(2018, 10, 14, 8, 20, 15))
67
71
 
68
72
  assert_equal 2, _query_count
@@ -26,9 +26,9 @@ class DeleteApiTest < MiniTest::Test
26
26
  end
27
27
 
28
28
  def test_delete
29
- stub_request(:any, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org')
29
+ stub_request(:any, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org')
30
30
  .to_return(status: 204)
31
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
31
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
32
32
  bucket: 'my-bucket',
33
33
  org: 'my-org',
34
34
  precision: InfluxDB2::WritePrecision::NANOSECOND,
@@ -40,13 +40,13 @@ class DeleteApiTest < MiniTest::Test
40
40
  body = '{"start":"2019-10-15T08:20:15+00:00","stop":"2019-11-15T08:20:15+00:00","predicate":"key1=\"value1\" ' \
41
41
  'AND key2=\"value\""}'
42
42
 
43
- assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
43
+ assert_requested(:post, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
44
44
  end
45
45
 
46
46
  def test_delete_time_as_date_time
47
- stub_request(:any, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org')
47
+ stub_request(:any, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org')
48
48
  .to_return(status: 204)
49
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
49
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
50
50
  bucket: 'my-bucket',
51
51
  org: 'my-org',
52
52
  precision: InfluxDB2::WritePrecision::NANOSECOND,
@@ -59,13 +59,13 @@ class DeleteApiTest < MiniTest::Test
59
59
  body = '{"start":"2019-02-03T04:05:06+07:00","stop":"2019-03-03T04:05:06+07:00","predicate":"key1=\"value1\" ' \
60
60
  'AND key2=\"value\""}'
61
61
 
62
- assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
62
+ assert_requested(:post, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
63
63
  end
64
64
 
65
65
  def test_delete_time_as_string
66
- stub_request(:any, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org')
66
+ stub_request(:any, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org')
67
67
  .to_return(status: 204)
68
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
68
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
69
69
  bucket: 'my-bucket',
70
70
  org: 'my-org',
71
71
  precision: InfluxDB2::WritePrecision::NANOSECOND,
@@ -77,13 +77,13 @@ class DeleteApiTest < MiniTest::Test
77
77
  body = '{"start":"2019-02-03T04:05:06+07:00","stop":"2019-04-03T04:05:06+07:00","predicate":"key1=\"value1\" ' \
78
78
  'AND key2=\"value\""}'
79
79
 
80
- assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
80
+ assert_requested(:post, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
81
81
  end
82
82
 
83
83
  def test_without_predicate
84
- stub_request(:any, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org')
84
+ stub_request(:any, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org')
85
85
  .to_return(status: 204)
86
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
86
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
87
87
  bucket: 'my-bucket',
88
88
  org: 'my-org',
89
89
  precision: InfluxDB2::WritePrecision::NANOSECOND,
@@ -94,13 +94,13 @@ class DeleteApiTest < MiniTest::Test
94
94
 
95
95
  body = '{"start":"2019-02-03T04:05:06+07:00","stop":"2019-04-03T04:05:06+07:00"}'
96
96
 
97
- assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
97
+ assert_requested(:post, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org', times: 1, body: body)
98
98
  end
99
99
 
100
100
  def test_user_agent_header
101
- stub_request(:any, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org')
101
+ stub_request(:any, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org')
102
102
  .to_return(status: 204)
103
- client = InfluxDB2::Client.new('http://localhost:9999', 'my-token',
103
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
104
104
  bucket: 'my-bucket',
105
105
  org: 'my-org',
106
106
  precision: InfluxDB2::WritePrecision::NANOSECOND,
@@ -115,7 +115,7 @@ class DeleteApiTest < MiniTest::Test
115
115
  'User-Agent' => "influxdb-client-ruby/#{InfluxDB2::VERSION}",
116
116
  'Content-Type' => 'application/json'
117
117
  }
118
- assert_requested(:post, 'http://localhost:9999/api/v2/delete?bucket=my-bucket&org=my-org',
118
+ assert_requested(:post, 'http://localhost:8086/api/v2/delete?bucket=my-bucket&org=my-org',
119
119
  times: 1, body: body, headers: headers)
120
120
  end
121
121
  end