influxdb 0.6.2 → 0.8.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +92 -0
  3. data/.rubocop.yml +4 -0
  4. data/CHANGELOG.md +34 -0
  5. data/README.md +80 -34
  6. data/Rakefile +1 -1
  7. data/bin/provision.sh +3 -3
  8. data/influxdb.gemspec +2 -2
  9. data/lib/influxdb/client.rb +15 -9
  10. data/lib/influxdb/client/http.rb +11 -1
  11. data/lib/influxdb/config.rb +7 -5
  12. data/lib/influxdb/errors.rb +1 -0
  13. data/lib/influxdb/point_value.rb +4 -1
  14. data/lib/influxdb/query/batch.rb +9 -3
  15. data/lib/influxdb/query/cluster.rb +2 -2
  16. data/lib/influxdb/query/continuous_query.rb +1 -1
  17. data/lib/influxdb/query/core.rb +11 -7
  18. data/lib/influxdb/query/database.rb +2 -2
  19. data/lib/influxdb/query/series.rb +6 -2
  20. data/lib/influxdb/query/user.rb +8 -8
  21. data/lib/influxdb/timestamp_conversion.rb +52 -12
  22. data/lib/influxdb/version.rb +1 -1
  23. data/lib/influxdb/writer/async.rb +38 -11
  24. data/lib/influxdb/writer/udp.rb +3 -0
  25. data/spec/influxdb/cases/async_client_spec.rb +59 -35
  26. data/spec/influxdb/cases/query_cluster_spec.rb +3 -3
  27. data/spec/influxdb/cases/query_continuous_query_spec.rb +1 -1
  28. data/spec/influxdb/cases/query_database_spec.rb +4 -4
  29. data/spec/influxdb/cases/query_series_spec.rb +24 -8
  30. data/spec/influxdb/cases/query_user_spec.rb +8 -8
  31. data/spec/influxdb/cases/querying_issue_7000_spec.rb +1 -1
  32. data/spec/influxdb/cases/querying_spec.rb +1 -1
  33. data/spec/influxdb/cases/retry_requests_spec.rb +1 -1
  34. data/spec/influxdb/cases/udp_client_spec.rb +8 -14
  35. data/spec/influxdb/client_spec.rb +2 -2
  36. data/spec/influxdb/config_spec.rb +44 -14
  37. data/spec/influxdb/logging_spec.rb +3 -0
  38. data/spec/influxdb/point_value_spec.rb +11 -1
  39. data/spec/influxdb/time_conversion_spec.rb +19 -0
  40. data/spec/smoke/smoke_spec.rb +2 -2
  41. data/spec/spec_helper.rb +4 -4
  42. metadata +13 -14
  43. data/.travis.yml +0 -55
@@ -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')
@@ -6,7 +6,8 @@ describe InfluxDB::PointValue do
6
6
  point = {
7
7
  series: '1= ,"\\1',
8
8
  tags: {
9
- '2= ,"\\2' => '3= ,"\\3'
9
+ '2= ,"\\2' => '3= ,"\\3',
10
+ '4' => "5\\", # issue #225
10
11
  },
11
12
  values: {
12
13
  '4= ,"\\4' => '5= ,"\\5',
@@ -25,6 +26,7 @@ describe InfluxDB::PointValue do
25
26
  series = [
26
27
  %(1=\\ \\,"\\1),
27
28
  %(2\\=\\ \\,"\\2=3\\=\\ \\,"\\3),
29
+ %(4=5\\ ),
28
30
  ]
29
31
  fields = [
30
32
  %(4\\=\\ \\,\\"\\4="5= ,\\"\\\\5"),
@@ -38,6 +40,14 @@ describe InfluxDB::PointValue do
38
40
  expected = series.join(",") + " " + fields.join(",")
39
41
  expect(point.dump).to eq(expected)
40
42
  end
43
+
44
+ context 'with empty values' do
45
+ let(:empty_values_data) { { series: 'test_series', values: {} } }
46
+
47
+ it 'should raise an exception' do
48
+ expect { InfluxDB::PointValue.new(empty_values_data) }.to raise_error(InfluxDB::LineProtocolError)
49
+ end
50
+ end
41
51
  end
42
52
 
43
53
  describe 'dump' do
@@ -23,4 +23,23 @@ RSpec.describe InfluxDB do
23
23
  .to raise_exception(/invalid time precision.*whatever/i)
24
24
  end
25
25
  end
26
+
27
+ describe ".now" do
28
+ {
29
+ "ns" => [:nanosecond, 1_513_009_229_111_222_333],
30
+ nil => [:nanosecond, 1_513_009_229_111_222_333],
31
+ "u" => [:microsecond, 1_513_009_229_111_222],
32
+ "ms" => [:millisecond, 1_513_009_229_111],
33
+ "s" => [:second, 1_513_009_229],
34
+ "m" => [:second, 25_216_820, 1_513_009_229],
35
+ "h" => [:second, 420_280, 1_513_009_229],
36
+ }.each do |precision, (name, expected, stub)|
37
+ it "should return the current time in #{precision.inspect}" do
38
+ expect(Process).to receive(:clock_gettime)
39
+ .with(Process::CLOCK_REALTIME, name)
40
+ .and_return(stub || expected)
41
+ expect(described_class.now(precision)).to eq(expected)
42
+ end
43
+ end
44
+ end
26
45
  end
@@ -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" => "2015-08-18T00:00:00Z",
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" => "2015-08-18T00:12:00Z",
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["TRAVIS"] != "true"
21
- config.filter_run_excluding smoke: ENV["TRAVIS"] != "true" || !ENV.key?("influx_version")
22
- puts "SMOKE TESTS ARE NOT CURRENTLY RUNNING" if ENV["TRAVIS"] != "true"
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["TRAVIS"] == "true"
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,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
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: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.60.0
61
+ version: 0.61.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.60.0
68
+ version: 0.61.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -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,9 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.7.6
172
- signing_key:
170
+ rubygems_version: 3.1.4
171
+ signing_key:
173
172
  specification_version: 4
174
173
  summary: Ruby library for InfluxDB.
175
174
  test_files:
data/.travis.yml DELETED
@@ -1,55 +0,0 @@
1
- sudo: required
2
- dist: trusty
3
- language: ruby
4
- before_install:
5
- - gem update --system --no-doc
6
- - gem install bundler --no-doc
7
- - gem update bundler --no-doc
8
- - bin/provision.sh
9
- rvm:
10
- - 2.2.9
11
- - 2.3.8
12
- - 2.4.5
13
- - 2.5.3
14
- - ruby-head
15
- env:
16
- - TEST_TASK=spec
17
-
18
- matrix:
19
- allow_failures:
20
- - rvm: jruby-head
21
- - rvm: ruby-head
22
- - rvm: jruby-9.1.5.0
23
- - rvm: 2.5.3
24
- env: influx_version=nightly channel=nightlies
25
- include:
26
- - rvm: 2.5.3
27
- env: TEST_TASK=rubocop
28
- - rvm: jruby-9.1.5.0
29
- - rvm: jruby-head
30
- env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
31
- - rvm: 2.5.3
32
- env: influx_version=1.0.2 pkghash=88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037
33
- - rvm: 2.5.3
34
- env: influx_version=1.1.0 pkghash=f1520a2e18e0ab47e8a8810671e07d5a47960e54f7553b78bebe7d3c7594742f
35
- - rvm: 2.5.3
36
- env: influx_version=1.2.4 pkghash=2fac8391e04aa1bec9151e8f0d8f18df030c866af2b4963ab7d86c6ddc172182
37
- - rvm: 2.5.3
38
- env: influx_version=1.3.6 pkghash=6406cdd21466bcb832b967078adaa9f07cb6ae524a6579c15141692031f5f840
39
- - rvm: 2.5.3
40
- env: influx_version=1.4.3 pkghash=0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359
41
- - rvm: 2.5.3
42
- env: influx_version=1.5.2 pkghash=42fede7b497bdf30d4eb5138db218d1add986fca4fce4a8bcd9c7d6dabaf572a
43
- - rvm: 2.5.3
44
- env: influx_version=1.6.1 pkghash=a833ac16890182a75983c61e5fe6471ae27cbab7984d7b7361034887b7428de2
45
- - rvm: 2.5.3
46
- env: influx_version=1.7.0 pkghash=0615a395b3f8e68455b0a8a2584d00ff8694f62caf77468900f7cf0a77f2b8be
47
- - rvm: 2.5.3
48
- env: influx_version=nightly channel=nightlies
49
- fail_fast: true
50
- addons:
51
- apt:
52
- packages:
53
- - haveged
54
- - libgmp-dev
55
- script: bundle exec rake $TEST_TASK