Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb5c6b1

Browse filesBrowse files
committed
Merge pull request influxdata#234 from influxdb/djeebus-issue-231
Djeebus issue 231
2 parents dcb446f + 78e5ada commit bb5c6b1
Copy full SHA for bb5c6b1

File tree

Expand file treeCollapse file tree

7 files changed

+52
-30
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+52
-30
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ install:
1313
- pip install tox
1414
- pip install coveralls
1515
- mkdir influxdb_install
16-
- wget https://s3.amazonaws.com/influxdb/influxdb_0.9.2_amd64.deb
16+
- wget https://s3.amazonaws.com/influxdb/influxdb_0.9.3_amd64.deb
1717
- dpkg -x influxdb_*_amd64.deb influxdb_install
1818
script:
19-
- export INFLUXDB_PYTHON_INFLUXD_PATH=$(pwd)/influxdb_install/opt/influxdb/versions/0.9.2/influxd
19+
- export INFLUXDB_PYTHON_INFLUXD_PATH=$(pwd)/influxdb_install/opt/influxdb/versions/0.9.3/influxd
2020
- travis_wait 30 tox -e $TOX_ENV
2121
after_success:
2222
- if [ "$TOX_ENV" == "coverage" ] ; then coveralls; fi

‎influxdb/line_protocol.py

Copy file name to clipboardExpand all lines: influxdb/line_protocol.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from numbers import Integral
88

99
from dateutil.parser import parse
10-
from six import binary_type, text_type
10+
from six import binary_type, text_type, integer_types
1111

1212

1313
def _convert_timestamp(timestamp, precision=None):
@@ -59,6 +59,8 @@ def _escape_value(value):
5959
"\n", "\\n"
6060
)
6161
)
62+
elif isinstance(value, integer_types):
63+
return str(value) + 'i'
6264
else:
6365
return str(value)
6466

‎influxdb/tests/dataframe_client_test.py

Copy file name to clipboardExpand all lines: influxdb/tests/dataframe_client_test.py
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def test_write_points_from_dataframe(self):
3232
columns=["column_one", "column_two",
3333
"column_three"])
3434
expected = (
35-
b"foo column_one=\"1\",column_three=1.0,column_two=1 0\n"
36-
b"foo column_one=\"2\",column_three=2.0,column_two=2 "
35+
b"foo column_one=\"1\",column_three=1.0,column_two=1i 0\n"
36+
b"foo column_one=\"2\",column_three=2.0,column_two=2i "
3737
b"3600000000000\n"
3838
)
3939

@@ -71,8 +71,8 @@ def test_write_points_from_dataframe_with_numeric_column_names(self):
7171
index=[now, now + timedelta(hours=1)])
7272

7373
expected = (
74-
b'foo,hello=there 0=\"1\",1=1,2=1.0 0\n'
75-
b'foo,hello=there 0=\"2\",1=2,2=2.0 3600000000000\n'
74+
b'foo,hello=there 0=\"1\",1=1i,2=1.0 0\n'
75+
b'foo,hello=there 0=\"2\",1=2i,2=2.0 3600000000000\n'
7676
)
7777

7878
with requests_mock.Mocker() as m:
@@ -92,8 +92,8 @@ def test_write_points_from_dataframe_with_period_index(self):
9292
columns=["column_one", "column_two",
9393
"column_three"])
9494
expected = (
95-
b"foo column_one=\"1\",column_three=1.0,column_two=1 0\n"
96-
b"foo column_one=\"2\",column_three=2.0,column_two=2 "
95+
b"foo column_one=\"1\",column_three=1.0,column_two=1i 0\n"
96+
b"foo column_one=\"2\",column_three=2.0,column_two=2i "
9797
b"86400000000000\n"
9898
)
9999

@@ -125,48 +125,48 @@ def test_write_points_from_dataframe_with_time_precision(self):
125125
cli.write_points(dataframe, measurement, time_precision='h')
126126
self.assertEqual(m.last_request.qs['precision'], ['h'])
127127
self.assertEqual(
128-
b'foo column_one="1",column_three=1.0,column_two=1 0\nfoo '
129-
b'column_one="2",column_three=2.0,column_two=2 1\n',
128+
b'foo column_one="1",column_three=1.0,column_two=1i 0\nfoo '
129+
b'column_one="2",column_three=2.0,column_two=2i 1\n',
130130
m.last_request.body,
131131
)
132132

133133
cli.write_points(dataframe, measurement, time_precision='m')
134134
self.assertEqual(m.last_request.qs['precision'], ['m'])
135135
self.assertEqual(
136-
b'foo column_one="1",column_three=1.0,column_two=1 0\nfoo '
137-
b'column_one="2",column_three=2.0,column_two=2 60\n',
136+
b'foo column_one="1",column_three=1.0,column_two=1i 0\nfoo '
137+
b'column_one="2",column_three=2.0,column_two=2i 60\n',
138138
m.last_request.body,
139139
)
140140

141141
cli.write_points(dataframe, measurement, time_precision='s')
142142
self.assertEqual(m.last_request.qs['precision'], ['s'])
143143
self.assertEqual(
144-
b'foo column_one="1",column_three=1.0,column_two=1 0\nfoo '
145-
b'column_one="2",column_three=2.0,column_two=2 3600\n',
144+
b'foo column_one="1",column_three=1.0,column_two=1i 0\nfoo '
145+
b'column_one="2",column_three=2.0,column_two=2i 3600\n',
146146
m.last_request.body,
147147
)
148148

149149
cli.write_points(dataframe, measurement, time_precision='ms')
150150
self.assertEqual(m.last_request.qs['precision'], ['ms'])
151151
self.assertEqual(
152-
b'foo column_one="1",column_three=1.0,column_two=1 0\nfoo '
153-
b'column_one="2",column_three=2.0,column_two=2 3600000\n',
152+
b'foo column_one="1",column_three=1.0,column_two=1i 0\nfoo '
153+
b'column_one="2",column_three=2.0,column_two=2i 3600000\n',
154154
m.last_request.body,
155155
)
156156

157157
cli.write_points(dataframe, measurement, time_precision='u')
158158
self.assertEqual(m.last_request.qs['precision'], ['u'])
159159
self.assertEqual(
160-
b'foo column_one="1",column_three=1.0,column_two=1 0\nfoo '
161-
b'column_one="2",column_three=2.0,column_two=2 3600000000\n',
160+
b'foo column_one="1",column_three=1.0,column_two=1i 0\nfoo '
161+
b'column_one="2",column_three=2.0,column_two=2i 3600000000\n',
162162
m.last_request.body,
163163
)
164164

165165
cli.write_points(dataframe, measurement, time_precision='n')
166166
self.assertEqual(m.last_request.qs['precision'], ['n'])
167167
self.assertEqual(
168-
b'foo column_one="1",column_three=1.0,column_two=1 0\n'
169-
b'foo column_one="2",column_three=2.0,column_two=2 '
168+
b'foo column_one="1",column_three=1.0,column_two=1i 0\n'
169+
b'foo column_one="2",column_three=2.0,column_two=2i '
170170
b'3600000000000\n',
171171
m.last_request.body,
172172
)

‎influxdb/tests/server_tests/client_test_with_server.py

Copy file name to clipboardExpand all lines: influxdb/tests/server_tests/client_test_with_server.py
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ def test_write_check_read(self):
303303
self.test_write()
304304
time.sleep(1)
305305
rsp = self.cli.query('SELECT * FROM cpu_load_short', database='db')
306-
self.assertListEqual([{'value': 0.64,
307-
'time': '2009-11-10T23:00:00Z'}],
306+
self.assertListEqual([{'value': 0.64, 'time': '2009-11-10T23:00:00Z',
307+
"host": "server01", "region": "us-west"}],
308308
list(rsp.get_points()))
309309

310310
def test_write_points(self):
@@ -328,7 +328,8 @@ def test_write_points_check_read(self):
328328

329329
self.assertEqual(
330330
list(rsp),
331-
[[{'value': 0.64, 'time': '2009-11-10T23:00:00Z'}]]
331+
[[{'value': 0.64, 'time': '2009-11-10T23:00:00Z',
332+
"host": "server01", "region": "us-west"}]]
332333
)
333334

334335
rsp2 = list(rsp.get_points())
@@ -337,7 +338,8 @@ def test_write_points_check_read(self):
337338

338339
self.assertEqual(
339340
pt,
340-
{'time': '2009-11-10T23:00:00Z', 'value': 0.64}
341+
{'time': '2009-11-10T23:00:00Z', 'value': 0.64,
342+
"host": "server01", "region": "us-west"}
341343
)
342344

343345
@unittest.skip("Broken as of 0.9.0")
@@ -367,15 +369,17 @@ def test_write_multiple_points_different_series(self):
367369
lrsp = list(rsp)
368370

369371
self.assertEqual(
370-
[[{'value': 0.64, 'time': '2009-11-10T23:00:00Z'}]],
372+
[[{'value': 0.64, 'time': '2009-11-10T23:00:00Z',
373+
"host": "server01", "region": "us-west"}]],
371374
lrsp
372375
)
373376

374377
rsp = list(self.cli.query('SELECT * FROM memory'))
375378

376379
self.assertEqual(
377380
rsp,
378-
[[{'value': 33, 'time': '2009-11-10T23:01:35Z'}]]
381+
[[{'value': 33, 'time': '2009-11-10T23:01:35Z',
382+
"host": "server01", "region": "us-west"}]]
379383
)
380384

381385
@unittest.skip("Broken as of 0.9.0")
@@ -678,6 +682,7 @@ def test_write_points_udp(self):
678682

679683
self.assertEqual(
680684
# this is dummy_points :
681-
[{'value': 0.64, 'time': '2009-11-10T23:00:00Z'}],
685+
[{'value': 0.64, 'time': '2009-11-10T23:00:00Z',
686+
"host": "server01", "region": "us-west"}],
682687
list(rsp['cpu_load_short'])
683688
)

‎influxdb/tests/server_tests/influxdb.conf.template

Copy file name to clipboardExpand all lines: influxdb/tests/server_tests/influxdb.conf.template
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
[data]
1212
dir = "{data_dir}"
13+
wal-dir = "{wal_dir}"
1314
retention-auto-create = true
1415
retention-check-enabled = true
1516
retention-check-period = "10m0s"
@@ -54,7 +55,7 @@
5455
retention-policy = ""
5556
consistency-level = "one"
5657

57-
[udp]
58+
[[udp]]
5859
enabled = {udp_enabled}
5960
bind-address = ":{udp_port}"
6061
database = "db"

‎influxdb/tests/server_tests/influxdb_instance.py

Copy file name to clipboardExpand all lines: influxdb/tests/server_tests/influxdb_instance.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ def __init__(self,
3131

3232
self.influxd_path = self.find_influxd_path()
3333

34+
errors = 0
35+
while True:
36+
try:
37+
self._start_server(conf_template, udp_enabled)
38+
break
39+
except RuntimeError: # Happens when the ports are already in use.
40+
errors += 1
41+
if errors > 2:
42+
raise e
43+
44+
def _start_server(self, conf_template, udp_enabled):
45+
3446
# create a temporary dir to store all needed files
3547
# for the influxdb server instance :
3648
self.temp_dir_base = tempfile.mkdtemp()
@@ -51,6 +63,7 @@ def __init__(self,
5163
conf_data = dict(
5264
meta_dir=os.path.join(tempdir, 'meta'),
5365
data_dir=os.path.join(tempdir, 'data'),
66+
wal_dir=os.path.join(tempdir, 'wal'),
5467
cluster_dir=os.path.join(tempdir, 'state'),
5568
handoff_dir=os.path.join(tempdir, 'handoff'),
5669
logs_file=os.path.join(self.temp_dir_base, 'logs.txt'),

‎influxdb/tests/test_line_protocol.py

Copy file name to clipboardExpand all lines: influxdb/tests/test_line_protocol.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_make_lines(self):
2020
"fields": {
2121
"string_val": "hello!",
2222
"int_val": 1,
23+
"float_val": 1.1,
2324
"none_field": None,
2425
}
2526
}
@@ -29,7 +30,7 @@ def test_make_lines(self):
2930
self.assertEqual(
3031
line_protocol.make_lines(data),
3132
'test,integer_tag=2,string_tag=hello '
32-
'int_val=1,string_val="hello!"\n'
33+
'float_val=1.1,int_val=1i,string_val="hello!"\n'
3334
)
3435

3536
def test_string_val_newline(self):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.