Skip to content

Commit 8d2ec24

Browse files
committed
Merge branch 'master' into f-refacor-clusterclient
2 parents 2b42775 + f659ced commit 8d2ec24

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
lines changed

.travis.yml

Lines 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.3_amd64.deb
16+
- wget https://s3.amazonaws.com/influxdb/influxdb_0.9.4.1_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.3/influxd
19+
- export INFLUXDB_PYTHON_INFLUXD_PATH=$(pwd)/influxdb_install/opt/influxdb/versions/0.9.4.1/influxd
2020
- travis_wait 30 tox -e $TOX_ENV
2121
after_success:
2222
- if [ "$TOX_ENV" == "coverage" ] ; then coveralls; fi

influxdb/tests/misc.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
1+
# -*- coding: utf-8 -*-
22

33
import socket
4-
import time
54

65

7-
def get_free_port(ip='127.0.0.1'):
8-
sock = socket.socket()
6+
def get_free_ports(num_ports, ip='127.0.0.1'):
7+
"""Get `num_ports` free/available ports on the interface linked to the `ip´
8+
:param int num_ports: The number of free ports to get
9+
:param str ip: The ip on which the ports have to be taken
10+
:return: a set of ports number
11+
"""
12+
sock_ports = []
13+
ports = set()
914
try:
10-
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
11-
sock.bind((ip, 0))
12-
return sock.getsockname()[1]
15+
for _ in range(num_ports):
16+
sock = socket.socket()
17+
cur = [sock, -1]
18+
# append the socket directly,
19+
# so that it'll be also closed (no leaked resource)
20+
# in the finally here after.
21+
sock_ports.append(cur)
22+
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
23+
sock.bind((ip, 0))
24+
cur[1] = sock.getsockname()[1]
1325
finally:
14-
sock.close()
15-
16-
# Is there a better way than a sleep?
17-
# There were issues on Travis where the port was not yet free.
18-
time.sleep(0.1)
26+
for sock, port in sock_ports:
27+
sock.close()
28+
ports.add(port)
29+
assert num_ports == len(ports)
30+
return ports
1931

2032

2133
def is_port_open(port, ip='127.0.0.1'):

influxdb/tests/server_tests/influxdb.conf.template

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@
6262
batch-size = 0
6363
batch-timeout = "0"
6464

65-
[monitoring]
66-
enabled = false
67-
write-interval = "1m0s"
65+
[monitor]
66+
store-enabled = false
6867

6968
[continuous_queries]
7069
enabled = true

influxdb/tests/server_tests/influxdb_instance.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import unittest
1313
import sys
1414

15-
from influxdb.tests.misc import get_free_port, is_port_open
15+
from influxdb.tests.misc import is_port_open, get_free_ports
1616

1717

1818
class InfluxDbInstance(object):
@@ -54,12 +54,12 @@ def _start_server(self, conf_template, udp_enabled):
5454
dir=self.temp_dir_base)
5555

5656
# find a couple free ports :
57-
ports = dict(
58-
http_port=get_free_port(),
59-
admin_port=get_free_port(),
60-
meta_port=get_free_port(),
61-
udp_port=get_free_port() if udp_enabled else -1,
62-
)
57+
free_ports = get_free_ports(4)
58+
ports = {}
59+
for service in 'http', 'admin', 'meta', 'udp':
60+
ports[service + '_port'] = free_ports.pop()
61+
if not udp_enabled:
62+
ports['udp_port'] = -1
6363

6464
conf_data = dict(
6565
meta_dir=os.path.join(tempdir, 'meta'),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy