influxdb 0.3.9 → 0.3.10

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
  SHA1:
3
- metadata.gz: 4126a6d8021cd7ae64f6ebc12bd9760ef482c9df
4
- data.tar.gz: 33c78e146fc49a8d0302ae0f4704837d1f3f5b9d
3
+ metadata.gz: e1335ca5adba19fcf5c4e9aefaa7860ccbfe5cc8
4
+ data.tar.gz: dd6c3fafc967d12eb4854db1ae7e0a3604257301
5
5
  SHA512:
6
- metadata.gz: 0b9ec022755c6e03bb0c2473102358c3f60b64eb80a44160ae5b0398d413e5f90c293e596a0996935a35e2ef50a2c90d091a6cb0690eab380bdca5e24b9b06e7
7
- data.tar.gz: 0058ee385c54b9b0a70bf794ab16b5a94a617825b58f4a9821fbdc668b0fa37bddea415fb762eab1b6cd7e3d517c2dc5da8d8ed9d9e35ea5fb50d796d27d9de0
6
+ metadata.gz: 4a0e9060cd27e1700f8bc814f0aff76ef41baa592a906ec1da2b61eb7d4bc558ca1cb6edc3297b057f5482334b6f855ffea36ee6b14f725882f80973d9bf2816
7
+ data.tar.gz: 7282436fe2ae3b971910561851c3c2ea1d328185ea08dcc6a1b666d477a99f8142df36dc7dd6b79546f9ea9392a7851a066a95417b543578f34de2204aa127a9
@@ -6,6 +6,7 @@ AllCops:
6
6
  - 'spec/**/*.rb'
7
7
  Exclude:
8
8
  - 'bin/**/*'
9
+ - 'smoke/**/*'
9
10
  DisplayCopNames: true
10
11
  StyleGuideCopsOnly: false
11
12
 
@@ -4,6 +4,7 @@ language: ruby
4
4
  before_install:
5
5
  - gem install bundler
6
6
  - gem update bundler
7
+ - smoke/provision.sh
7
8
  rvm:
8
9
  - 1.9.3
9
10
  - 2.0.0
@@ -13,11 +14,14 @@ rvm:
13
14
  - ruby-head
14
15
  env:
15
16
  - TEST_TASK=spec
17
+
16
18
  matrix:
17
19
  allow_failures:
18
20
  - rvm: jruby-head
19
21
  - rvm: ruby-head
20
22
  - rvm: jruby-9.0.5.0
23
+ - rvm: 2.3.1
24
+ env: TEST_TASK=smoke influx_version=nightly channel=nightlies
21
25
  include:
22
26
  - rvm: 2.3.1
23
27
  env: TEST_TASK=rubocop
@@ -25,6 +29,18 @@ matrix:
25
29
  env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
26
30
  - rvm: jruby-head
27
31
  env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
32
+ - rvm: 2.3.1
33
+ env: TEST_TASK=smoke influx_version=0.10.3-1 pkghash=96244557d9bb7485ddc9d084ff7ce783
34
+ - rvm: 2.3.1
35
+ env: TEST_TASK=smoke influx_version=0.11.1-1 pkghash=f4cf8363125038dff038ced6b16bcafd
36
+ - rvm: 2.3.1
37
+ env: TEST_TASK=smoke influx_version=0.12.2-1 pkghash=f28bb1c57d52dc1593dca45b86be5913
38
+ - rvm: 2.3.1
39
+ env: TEST_TASK=smoke influx_version=0.13.0 pkghash=4f0aa76fee22cf4c18e2a0779ba4f462
40
+ - rvm: 2.3.1
41
+ env: TEST_TASK=smoke influx_version=1.0.0 pkghash=a25daf049d2482166b248fe2d0be4b69
42
+ - rvm: 2.3.1
43
+ env: TEST_TASK=smoke influx_version=nightly channel=nightlies
28
44
  fail_fast: true
29
45
  addons:
30
46
  apt:
@@ -6,6 +6,10 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
6
6
 
7
7
  - None.
8
8
 
9
+ ## v0.3.10, released 2016-10-03
10
+
11
+ - Bugfix in `Query::Builder#quote` (#168, @cthulhu666).
12
+
9
13
  ## v0.3.9, released 2016-09-20
10
14
 
11
15
  - Changed retry behaviour slightly. When the server responds with an incomplete
data/Rakefile CHANGED
@@ -1,22 +1,27 @@
1
+ require "rake/testtask"
1
2
  require "bundler/gem_tasks"
2
- require 'rubocop/rake_task'
3
+ require "rubocop/rake_task"
3
4
 
4
5
  RuboCop::RakeTask.new
5
6
 
6
7
  targeted_files = ARGV.drop(1)
7
- file_pattern = targeted_files.empty? ? 'spec/**/*_spec.rb' : targeted_files
8
+ file_pattern = targeted_files.empty? ? "spec/**/*_spec.rb" : targeted_files
8
9
 
9
- require 'rspec/core'
10
- require 'rspec/core/rake_task'
10
+ require "rspec/core"
11
+ require "rspec/core/rake_task"
11
12
 
12
13
  RSpec::Core::RakeTask.new(:spec) do |t|
13
14
  t.pattern = FileList[file_pattern]
14
15
  end
15
16
 
17
+ Rake::TestTask.new(:smoke) do |t|
18
+ t.test_files = FileList["smoke/*.rb"]
19
+ end
20
+
16
21
  task default: [:spec, :rubocop]
17
22
 
18
23
  task :console do
19
- lib = File.expand_path('../lib', __FILE__)
24
+ lib = File.expand_path("../lib", __FILE__)
20
25
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
21
26
  require "influxdb"
22
27
 
@@ -24,14 +29,13 @@ task :console do
24
29
  require "pry-byebug"
25
30
  Pry.start
26
31
  rescue LoadError
27
- puts <<-TEXT.gsub(/^\s{6}([^ ])/, '\1')
32
+ puts <<-TEXT.gsub(/^\s{6}([^ ])/, "\1"), ""
28
33
  Could not load pry-byebug. Create a file Gemfile.local with
29
34
  the following line, if you want to get rid of this message:
30
35
 
31
36
  \tgem "pry-byebug"
32
37
 
33
38
  (don't forget to run bundle afterwards). Falling back to IRB.
34
-
35
39
  TEXT
36
40
 
37
41
  require "irb"
@@ -39,3 +43,9 @@ task :console do
39
43
  IRB.start
40
44
  end
41
45
  end
46
+
47
+ if !ENV.key?("influx_version") || ENV["influx_version"] == ""
48
+ task default: :spec
49
+ elsif ENV["TRAVIS"] == "true"
50
+ task default: :smoke
51
+ end
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.files = `git ls-files`.split($/)
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_runtime_dependency "json"
@@ -22,7 +22,7 @@ module InfluxDB
22
22
  when Integer, Float, TrueClass, FalseClass
23
23
  param.to_s
24
24
  else
25
- raise ArgumentError, "Unexpected parameter type #{p.class} (#{p.inspect})"
25
+ raise ArgumentError, "Unexpected parameter type #{param.class} (#{param.inspect})"
26
26
  end
27
27
  end
28
28
 
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.3.9".freeze
2
+ VERSION = "0.3.10".freeze
3
3
  end
@@ -0,0 +1,18 @@
1
+ require "influxdb"
2
+
3
+ puts __FILE__
4
+ puts "\tThis file contains some sanity checks."
5
+ puts
6
+
7
+ client = InfluxDB::Client.new \
8
+ username: "test_user",
9
+ password: "resu_tset",
10
+ retry: 4
11
+
12
+ version = client.version
13
+
14
+ if version
15
+ puts "Got version: #{version}"
16
+ else
17
+ raise "version is empty"
18
+ end
@@ -0,0 +1,61 @@
1
+ require "influxdb"
2
+
3
+ puts __FILE__
4
+ puts "\tThis is basically a test whether the examples in documented on"
5
+ puts "\thttp://docs.influxdata.com/influxdb/v0.13/sample_data/data_download/"
6
+ puts "\twork with the Ruby client."
7
+ puts
8
+
9
+ client = InfluxDB::Client.new \
10
+ database: "NOAA_water_database",
11
+ username: "test_user",
12
+ password: "resu_tset",
13
+ retry: 4
14
+
15
+ def test_case(name)
16
+ print name
17
+ yield
18
+ puts " [ OK ]"
19
+ rescue
20
+ puts " [FAIL]"
21
+ puts $!.message
22
+ exit 1
23
+ end
24
+
25
+ test_case "See all five measurements?" do
26
+ result = client.query "show measurements"
27
+ expected = %w[ average_temperature h2o_feet h2o_pH h2o_quality h2o_temperature ]
28
+ actual = result[0]["values"].map{|v| v["name"] }
29
+ unexpected = actual - expected
30
+ raise "unexpected measurements: #{unexpected.join(", ")}" if unexpected.any?
31
+ end
32
+
33
+ test_case "Count the number of non-null values of water_level in h2o_feet" do
34
+ result = client.query "select count(water_level) from h2o_feet"
35
+ expected = 15258
36
+ actual = result[0]["values"][0]["count"]
37
+ raise "expected to find #{expected} points, got #{actual}" if expected != actual
38
+ end
39
+
40
+ test_case "Select the first five observations in the measurement h2o_feet" do
41
+ result = client.query("select * from h2o_feet limit 5").first["values"]
42
+ expected = 5
43
+ actual = result.size
44
+ raise "expected #{expected} observations, got #{actual}" if expected != actual
45
+
46
+ expected = {
47
+ "time" => "2015-08-18T00:00:00Z",
48
+ "level description" => "between 6 and 9 feet",
49
+ "location" => "coyote_creek",
50
+ "water_level" => 8.12
51
+ }
52
+ raise "unexpected first result, got #{result[0]}" if expected != result[0]
53
+
54
+ expected = {
55
+ "time" => "2015-08-18T00:12:00Z",
56
+ "level description" => "between 6 and 9 feet",
57
+ "location" => "coyote_creek",
58
+ "water_level" => 7.887
59
+ }
60
+ raise "unexpected last result, got #{result[-1]}" if expected != result[-1]
61
+ end
@@ -0,0 +1,92 @@
1
+ #!/bin/sh -e
2
+
3
+ if [ -z "$influx_version" ]; then
4
+ echo "== Provisioning InfluxDB: Skipping, influx_version is empty"
5
+ exit 0
6
+ else
7
+ echo "== Provisioning InfluxDB ${influx_version}"
8
+ fi
9
+
10
+ package_name="influxdb_${influx_version}_amd64.deb"
11
+ [ -z "${channel}" ] && channel="releases"
12
+ download_url="https://dl.influxdata.com/influxdb/${channel}/${package_name}"
13
+
14
+
15
+ echo "== Downloading package"
16
+
17
+ if which curl 2>&1 >/dev/null; then
18
+ curl "${download_url}" > "${HOME}/${package_name}"
19
+ else
20
+ echo >&2 "E: Could not find curl"
21
+ exit 1
22
+ fi
23
+
24
+ echo "== Download verification"
25
+ hash_sum=$(md5sum "${HOME}/${package_name}" | awk '{ print $1 }')
26
+
27
+ if [ -z "${pkghash}" ]; then
28
+ echo "-- Skipping, pkghash is empty"
29
+ else
30
+ if [ "${hash_sum}" != "${pkghash}" ]; then
31
+ echo >&2 "E: Hash sum mismatch (got ${hash_sum}, expected ${pkghash})"
32
+ exit 1
33
+ fi
34
+ fi
35
+ echo "-- Download has MD5 hash: ${hash_sum}"
36
+
37
+
38
+ echo "== Installing"
39
+
40
+ sudo dpkg -i "${HOME}/${package_name}"
41
+ sudo /etc/init.d/influxdb start
42
+
43
+ echo "-- waiting for daemon to start"
44
+ while ! curl --head --fail --silent http://localhost:8086/ping; do
45
+ echo -n "."
46
+ sleep 1
47
+ done
48
+
49
+
50
+ echo "== Configuring"
51
+
52
+ echo "-- create admin user"
53
+ /usr/bin/influx -execute "CREATE USER root WITH PASSWORD 'toor' WITH ALL PRIVILEGES"
54
+
55
+ echo "-- create non-admin user"
56
+ /usr/bin/influx -execute "CREATE USER test_user WITH PASSWORD 'resu_tset'"
57
+
58
+ echo "-- create databases"
59
+ /usr/bin/influx -execute "CREATE DATABASE db_one"
60
+ /usr/bin/influx -execute "CREATE DATABASE db_two"
61
+
62
+ echo "-- grant access"
63
+ /usr/bin/influx -execute "GRANT ALL ON db_two TO test_user"
64
+
65
+
66
+ echo "== Download and import NOAA sample data"
67
+
68
+ curl https://s3-us-west-1.amazonaws.com/noaa.water.database.0.9/NOAA_data.txt > noaa.txt
69
+ /usr/bin/influx -import -path noaa.txt -precision s
70
+
71
+ echo "-- grant access"
72
+ /usr/bin/influx -execute "GRANT ALL ON NOAA_water_database TO test_user"
73
+
74
+
75
+ echo "== Enable authentication"
76
+
77
+ if [ ! -f /etc/influxdb/influxdb.conf ]; then
78
+ echo >&2 "E: config file not found"
79
+ exit 1
80
+ fi
81
+
82
+ sudo sed -i 's/auth-enabled = false/auth-enabled = true/' /etc/influxdb/influxdb.conf
83
+ sudo /etc/init.d/influxdb restart
84
+
85
+ echo "-- waiting for daemon to restart"
86
+ while ! curl --head --fail --silent http://localhost:8086/ping; do
87
+ echo -n "."
88
+ sleep 1
89
+ done
90
+
91
+
92
+ echo "== Done"
@@ -18,6 +18,8 @@ RSpec.describe InfluxDB::Query::Builder do
18
18
  expect(subject.quote(0 || 1)).to eq "0"
19
19
 
20
20
  expect(subject.quote(:symbol)).to eq "'symbol'"
21
+
22
+ expect { subject.quote(/regex/) }.to raise_error(ArgumentError, /Unexpected parameter type Regex/)
21
23
  end
22
24
  end
23
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Persen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-20 00:00:00.000000000 Z
11
+ date: 2016-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -142,6 +142,9 @@ files:
142
142
  - lib/influxdb/version.rb
143
143
  - lib/influxdb/writer/async.rb
144
144
  - lib/influxdb/writer/udp.rb
145
+ - smoke/connect-and-get-version.rb
146
+ - smoke/noaa-sample-data.rb
147
+ - smoke/provision.sh
145
148
  - spec/influxdb/cases/async_client_spec.rb
146
149
  - spec/influxdb/cases/query_cluster_spec.rb
147
150
  - spec/influxdb/cases/query_continuous_query_spec.rb
@@ -191,6 +194,9 @@ signing_key:
191
194
  specification_version: 4
192
195
  summary: Ruby library for InfluxDB.
193
196
  test_files:
197
+ - smoke/connect-and-get-version.rb
198
+ - smoke/noaa-sample-data.rb
199
+ - smoke/provision.sh
194
200
  - spec/influxdb/cases/async_client_spec.rb
195
201
  - spec/influxdb/cases/query_cluster_spec.rb
196
202
  - spec/influxdb/cases/query_continuous_query_spec.rb