influxdb 0.3.10 → 0.3.11

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: e1335ca5adba19fcf5c4e9aefaa7860ccbfe5cc8
4
- data.tar.gz: dd6c3fafc967d12eb4854db1ae7e0a3604257301
3
+ metadata.gz: 517db1c21a2efdd7d7c7e5e94ae64cca4eb3a5c3
4
+ data.tar.gz: dd2672cc951a3a920375902e65e9b15252d01c8d
5
5
  SHA512:
6
- metadata.gz: 4a0e9060cd27e1700f8bc814f0aff76ef41baa592a906ec1da2b61eb7d4bc558ca1cb6edc3297b057f5482334b6f855ffea36ee6b14f725882f80973d9bf2816
7
- data.tar.gz: 7282436fe2ae3b971910561851c3c2ea1d328185ea08dcc6a1b666d477a99f8142df36dc7dd6b79546f9ea9392a7851a066a95417b543578f34de2204aa127a9
6
+ metadata.gz: febf1da8976eb80dd67dc0e85c671e1e1f650c7fdc74da7894ca2b6df9e434c63ed5fc700efc7c105899a9c8146c4ad8e61f902da73298588cb3b1f38d01c279
7
+ data.tar.gz: 4d735fb568163110e21c1a8cc0300658948a99489391fe41476e6308fabf16de027211ae149912328bbbd126b5823e98042ac8418f4c97e6280ce3a8b1db211a
data/.travis.yml CHANGED
@@ -38,7 +38,7 @@ matrix:
38
38
  - rvm: 2.3.1
39
39
  env: TEST_TASK=smoke influx_version=0.13.0 pkghash=4f0aa76fee22cf4c18e2a0779ba4f462
40
40
  - rvm: 2.3.1
41
- env: TEST_TASK=smoke influx_version=1.0.0 pkghash=a25daf049d2482166b248fe2d0be4b69
41
+ env: TEST_TASK=smoke influx_version=1.0.2 pkghash=3e4c349cb57507913d9abda1459bdbed
42
42
  - rvm: 2.3.1
43
43
  env: TEST_TASK=smoke influx_version=nightly channel=nightlies
44
44
  fail_fast: true
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
6
6
 
7
7
  - None.
8
8
 
9
+ ## v0.3.11, released 2016-10-12
10
+
11
+ - Bugfix/Enhancement in `PointValue#escape`. Input strings are now scrubbed
12
+ of invalid UTF byte sequences (#169, @ton31337).
13
+
9
14
  ## v0.3.10, released 2016-10-03
10
15
 
11
16
  - Bugfix in `Query::Builder#quote` (#168, @cthulhu666).
@@ -30,8 +30,14 @@ module InfluxDB
30
30
  }.freeze
31
31
 
32
32
  def escape(s, type)
33
+ # rubocop:disable Style/AlignParameters
34
+ s = s.encode "UTF-8".freeze, "binary".freeze,
35
+ invalid: :replace,
36
+ undef: :replace,
37
+ replace: "".freeze
38
+
33
39
  ESCAPES[type].each do |ch|
34
- s = s.gsub(ch) { "\\#{ch}" }
40
+ s = s.encode.gsub(ch) { "\\#{ch}" }
35
41
  end
36
42
  s
37
43
  end
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.3.10".freeze
2
+ VERSION = "0.3.11".freeze
3
3
  end
@@ -12,11 +12,19 @@ client = InfluxDB::Client.new \
12
12
  password: "resu_tset",
13
13
  retry: 4
14
14
 
15
+ TestFailure = Class.new StandardError
16
+ TestAllowedFailure = Class.new StandardError
17
+
15
18
  def test_case(name)
16
19
  print name
17
20
  yield
18
21
  puts " [ OK ]"
19
- rescue
22
+
23
+ rescue TestAllowedFailure
24
+ puts " [WARN]"
25
+ puts $!.message
26
+
27
+ rescue TestFailure
20
28
  puts " [FAIL]"
21
29
  puts $!.message
22
30
  exit 1
@@ -27,21 +35,27 @@ test_case "See all five measurements?" do
27
35
  expected = %w[ average_temperature h2o_feet h2o_pH h2o_quality h2o_temperature ]
28
36
  actual = result[0]["values"].map{|v| v["name"] }
29
37
  unexpected = actual - expected
30
- raise "unexpected measurements: #{unexpected.join(", ")}" if unexpected.any?
38
+ if unexpected.any?
39
+ raise TestFailure, "unexpected measurements: #{unexpected.join(", ")}"
40
+ end
31
41
  end
32
42
 
33
43
  test_case "Count the number of non-null values of water_level in h2o_feet" do
34
44
  result = client.query "select count(water_level) from h2o_feet"
35
45
  expected = 15258
36
46
  actual = result[0]["values"][0]["count"]
37
- raise "expected to find #{expected} points, got #{actual}" if expected != actual
47
+ if expected != actual
48
+ raise TestFailure, "expected to find #{expected} points, got #{actual}"
49
+ end
38
50
  end
39
51
 
40
52
  test_case "Select the first five observations in the measurement h2o_feet" do
41
53
  result = client.query("select * from h2o_feet limit 5").first["values"]
42
54
  expected = 5
43
55
  actual = result.size
44
- raise "expected #{expected} observations, got #{actual}" if expected != actual
56
+ if expected != actual
57
+ raise TestFailure, "expected #{expected} observations, got #{actual}"
58
+ end
45
59
 
46
60
  expected = {
47
61
  "time" => "2015-08-18T00:00:00Z",
@@ -49,7 +63,9 @@ test_case "Select the first five observations in the measurement h2o_feet" do
49
63
  "location" => "coyote_creek",
50
64
  "water_level" => 8.12
51
65
  }
52
- raise "unexpected first result, got #{result[0]}" if expected != result[0]
66
+ if expected != result[0]
67
+ raise TestAllowedFailure, "unexpected first result, got #{result[0]}"
68
+ end
53
69
 
54
70
  expected = {
55
71
  "time" => "2015-08-18T00:12:00Z",
@@ -57,5 +73,7 @@ test_case "Select the first five observations in the measurement h2o_feet" do
57
73
  "location" => "coyote_creek",
58
74
  "water_level" => 7.887
59
75
  }
60
- raise "unexpected last result, got #{result[-1]}" if expected != result[-1]
76
+ if expected != result[-1]
77
+ raise TestAllowedFailure, "unexpected last result, got #{result[-1]}"
78
+ end
61
79
  end
@@ -5,15 +5,22 @@ describe InfluxDB::PointValue do
5
5
  let(:data) do
6
6
  {
7
7
  series: '1= ,"\\1',
8
- tags: { '2= ,"\\2' => '3= ,"\\3' },
9
- values: { '4= ,"\\4' => '5= ,"\\5', intval: 5, floatval: 7.0 }
8
+ tags: {
9
+ '2= ,"\\2' => '3= ,"\\3'
10
+ },
11
+ values: {
12
+ '4= ,"\\4' => '5= ,"\\5',
13
+ intval: 5,
14
+ floatval: 7.0,
15
+ encoding: "a\255 b"
16
+ }
10
17
  }
11
18
  end
12
19
 
13
20
  it 'should escape correctly' do
14
21
  point = InfluxDB::PointValue.new(data)
15
22
  expected = %(1=\\ \\,"\\1,2\\=\\ \\,"\\2=3\\=\\ \\,"\\3 ) +
16
- %(4\\=\\ \\,\\"\\4="5= ,\\"\\5",intval=5i,floatval=7.0)
23
+ %(4\\=\\ \\,\\"\\4="5= ,\\"\\5",intval=5i,floatval=7.0,encoding="a b")
17
24
  expect(point.dump).to eq(expected)
18
25
  end
19
26
  end
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.10
4
+ version: 0.3.11
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-10-03 00:00:00.000000000 Z
11
+ date: 2016-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json