Skip to content

Commit ae67cce

Browse files
committed
Merge pull request influxdata#155 from influxdb/revert-152-adapt_for_last_server_update
Revert "Sync tests against last master update"
2 parents ede6e0a + 92c964c commit ae67cce

File tree

5 files changed

+160
-107
lines changed

5 files changed

+160
-107
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
install:
1313
- sudo pip install tox
1414
- sudo pip install coveralls
15-
- ./build_influxdb_server.sh
15+
- wget http://get.influxdb.org/influxdb_0.9.0-rc18_amd64.deb && sudo dpkg -i influxdb_0.9.0-rc18_amd64.deb
1616
script:
1717
- travis_wait tox -e $TOX_ENV
1818
after_success:

build_influxdb_server.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

tests/influxdb/client_test_with_server.py

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class InfluxDbInstance(object):
133133
in a temporary place, using a config file template.
134134
'''
135135

136-
def __init__(self, conf_template, udp_enabled=False):
136+
def __init__(self, conf_template):
137137
# create a temporary dir to store all needed files
138138
# for the influxdb server instance :
139139
self.temp_dir_base = tempfile.mkdtemp()
@@ -142,28 +142,28 @@ def __init__(self, conf_template, udp_enabled=False):
142142
tempdir = self.temp_dir_influxdb = tempfile.mkdtemp(
143143
dir=self.temp_dir_base)
144144
# we need some "free" ports :
145-
146-
ports = dict(
147-
broker_port=get_free_port(),
148-
webui_port=get_free_port(),
149-
admin_port=get_free_port(),
150-
udp_port=get_free_port() if udp_enabled else -1,
151-
)
152-
153-
conf_data = dict(
154-
broker_raft_dir=os.path.join(tempdir, 'raft'),
155-
broker_node_dir=os.path.join(tempdir, 'db'),
156-
cluster_dir=os.path.join(tempdir, 'state'),
157-
logs_file=os.path.join(self.temp_dir_base, 'logs.txt'),
158-
udp_enabled='true' if udp_enabled else 'false',
159-
)
160-
conf_data.update(ports)
161-
self.__dict__.update(conf_data)
145+
self.broker_port = get_free_port()
146+
self.admin_port = get_free_port()
147+
self.udp_port = get_free_port()
148+
self.snapshot_port = get_free_port()
149+
150+
self.logs_file = os.path.join(self.temp_dir_base, 'logs.txt')
151+
152+
with open(conf_template) as fh:
153+
conf = fh.read().format(
154+
broker_port=self.broker_port,
155+
admin_port=self.admin_port,
156+
udp_port=self.udp_port,
157+
broker_raft_dir=os.path.join(tempdir, 'raft'),
158+
broker_node_dir=os.path.join(tempdir, 'db'),
159+
cluster_dir=os.path.join(tempdir, 'state'),
160+
logfile=self.logs_file,
161+
snapshot_port=self.snapshot_port,
162+
)
162163

163164
conf_file = os.path.join(self.temp_dir_base, 'influxdb.conf')
164165
with open(conf_file, "w") as fh:
165-
with open(conf_template) as fh_template:
166-
fh.write(fh_template.read().format(**conf_data))
166+
fh.write(conf)
167167

168168
# now start the server instance:
169169
proc = self.proc = subprocess.Popen(
@@ -182,13 +182,8 @@ def __init__(self, conf_template, udp_enabled=False):
182182
# or you run a 286 @ 1Mhz ?
183183
try:
184184
while time.time() < timeout:
185-
if (is_port_open(self.webui_port)
185+
if (is_port_open(self.broker_port)
186186
and is_port_open(self.admin_port)):
187-
# it's hard to check if a UDP port is open..
188-
if udp_enabled:
189-
# so let's just sleep 0.5 sec in this case
190-
# to be sure that the server has open the port
191-
time.sleep(0.5)
192187
break
193188
time.sleep(0.5)
194189
if proc.poll() is not None:
@@ -197,13 +192,13 @@ def __init__(self, conf_template, udp_enabled=False):
197192
proc.terminate()
198193
proc.wait()
199194
raise RuntimeError('Timeout waiting for influxdb to listen'
200-
' on its ports (%s)' % ports)
195+
' on its broker port')
201196
except RuntimeError as err:
202197
data = self.get_logs_and_output()
203198
data['reason'] = str(err)
204199
data['now'] = datetime.datetime.now()
205200
raise RuntimeError("%(now)s > %(reason)s. RC=%(rc)s\n"
206-
"stdout=%(out)s\nstderr=%(err)s\nlogs=%(logs)r"
201+
"stdout=%(out)r\nstderr=%(err)r\nlogs=%(logs)r"
207202
% data)
208203

209204
def get_logs_and_output(self):
@@ -230,11 +225,9 @@ def close(self, remove_tree=True):
230225

231226

232227
def _setup_influxdb_server(inst):
233-
inst.influxd_inst = InfluxDbInstance(
234-
inst.influxdb_template_conf,
235-
udp_enabled=getattr(inst, 'influxdb_udp_enabled', False))
228+
inst.influxd_inst = InfluxDbInstance(inst.influxdb_template_conf)
236229
inst.cli = InfluxDBClient('localhost',
237-
inst.influxd_inst.webui_port,
230+
inst.influxd_inst.broker_port,
238231
'root', '', database='db')
239232

240233

@@ -660,14 +653,12 @@ def test_tags_json_order(self):
660653
class UdpTests(ManyTestCasesWithServerMixin,
661654
unittest.TestCase):
662655

663-
influxdb_udp_enabled = True
664-
665656
influxdb_template_conf = os.path.join(THIS_DIR,
666-
'influxdb.conf.template')
657+
'influxdb.udp_conf.template')
667658

668659
def test_write_points_udp(self):
669660
cli = InfluxDBClient(
670-
'localhost', self.influxd_inst.webui_port,
661+
'localhost', self.influxd_inst.broker_port,
671662
'dont', 'care',
672663
database='db',
673664
use_udp=True, udp_port=self.influxd_inst.udp_port

tests/influxdb/influxdb.conf.template

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# that can be resolved here.
66
# hostname = ""
77
bind-address = "0.0.0.0"
8-
port = {webui_port}
98

109
# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
1110
# The data includes raft id (random 8 bytes), os, arch and version
@@ -15,6 +14,11 @@ port = {webui_port}
1514
# Change this option to true to disable reporting.
1615
reporting-disabled = false
1716

17+
# Controls settings for initial start-up. Once a node a successfully started,
18+
# these settings are ignored.
19+
[initialization]
20+
join-urls = "" # Comma-delimited URLs, in the form http://host:port, for joining another cluster.
21+
1822
# Control authentication
1923
# If not set authetication is DISABLED. Be sure to explicitly set this flag to
2024
# true if you want authentication.
@@ -49,57 +53,52 @@ enabled = false
4953
#database = "collectd_database"
5054
#typesdb = "types.db"
5155

52-
# Configure the OpenTSDB input.
53-
[opentsdb]
54-
enabled = false
55-
#address = "0.0.0.0" # If not set, is actually set to bind-address.
56-
#port = 4242
57-
#database = "opentsdb_database"
58-
5956
# Configure UDP listener for series data.
6057
[udp]
61-
enabled = {udp_enabled}
58+
enabled = false
6259
#bind-address = "0.0.0.0"
6360
#port = 4444
64-
port = {udp_port}
6561

6662
# Broker configuration. Brokers are nodes which participate in distributed
6763
# consensus.
6864
[broker]
69-
enabled = true
7065
# Where the Raft logs are stored. The user running InfluxDB will need read/write access.
71-
#dir = "/var/opt/influxdb/raft"
7266
dir = "{broker_raft_dir}"
7367
port = {broker_port}
7468

7569
# Data node configuration. Data nodes are where the time-series data, in the form of
7670
# shards, is stored.
7771
[data]
78-
enabled = true
79-
#dir = "/var/opt/influxdb/db"
80-
dir = "{broker_node_dir}"
72+
dir = "{broker_node_dir}"
73+
port = {broker_port}
8174

82-
# Auto-create a retention policy when a database is created. Defaults to true.
83-
retention-auto-create = true
75+
# Auto-create a retention policy when a database is created. Defaults to true.
76+
retention-auto-create = true
8477

85-
# Control whether retention policies are enforced and how long the system waits between
86-
# enforcing those policies.
87-
retention-check-enabled = true
88-
retention-check-period = "10m"
78+
# Control whether retention policies are enforced and how long the system waits between
79+
# enforcing those policies.
80+
retention-check-enabled = true
81+
retention-check-period = "10m"
8982

90-
# Configuration for snapshot endpoint.
91-
[snapshot]
92-
enabled = false # Enabled by default if not set.
93-
bind-address = "127.0.0.1"
94-
port = 8087
83+
[cluster]
84+
# Location for cluster state storage. For storing state persistently across restarts.
85+
dir = "{cluster_dir}"
9586

9687
[logging]
88+
file = "{logfile}" # Leave blank to redirect logs to stderr.
9789
write-tracing = false # If true, enables detailed logging of the write system.
9890
raft-tracing = false # If true, enables detailed logging of Raft consensus.
9991

100-
# InfluxDB can store statistical and diagnostic information about itself. This is useful for
101-
# monitoring purposes. This feature is disabled by default, but if enabled, these data can be
102-
# queried like any other data.
103-
[monitoring]
92+
# InfluxDB can store statistics about itself. This is useful for monitoring purposes.
93+
# This feature is disabled by default, but if enabled, these statistics can be queried
94+
# as any other data.
95+
[statistics]
10496
enabled = false
97+
database = "internal" # The database to which the data is written.
98+
retention-policy = "default" # The retention policy within the database.
10599
write-interval = "1m" # Period between writing the data.
100+
101+
102+
[snapshot]
103+
bind-address = "127.0.0.1"
104+
port = {snapshot_port}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Welcome to the InfluxDB configuration file.
2+
3+
# If hostname (on the OS) doesn't return a name that can be resolved by the other
4+
# systems in the cluster, you'll have to set the hostname to an IP or something
5+
# that can be resolved here.
6+
# hostname = ""
7+
bind-address = "0.0.0.0"
8+
9+
# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
10+
# The data includes raft id (random 8 bytes), os, arch and version
11+
# We don't track ip addresses of servers reporting. This is only used
12+
# to track the number of instances running and the versions, which
13+
# is very helpful for us.
14+
# Change this option to true to disable reporting.
15+
reporting-disabled = false
16+
17+
# Controls settings for initial start-up. Once a node a successfully started,
18+
# these settings are ignored.
19+
[initialization]
20+
join-urls = "" # Comma-delimited URLs, in the form http://host:port, for joining another cluster.
21+
22+
# Control authentication
23+
# If not set authetication is DISABLED. Be sure to explicitly set this flag to
24+
# true if you want authentication.
25+
[authentication]
26+
enabled = false
27+
28+
# Configure the admin server
29+
[admin]
30+
enabled = true
31+
port = {admin_port}
32+
33+
# Configure the HTTP API endpoint. All time-series data and queries uses this endpoint.
34+
[api]
35+
# ssl-port = 8087 # SSL support is enabled if you set a port and cert
36+
# ssl-cert = "/path/to/cert.pem"
37+
38+
# Configure the Graphite plugins.
39+
[[graphite]] # 1 or more of these sections may be present.
40+
enabled = false
41+
# protocol = "" # Set to "tcp" or "udp"
42+
# address = "0.0.0.0" # If not set, is actually set to bind-address.
43+
# port = 2003
44+
# name-position = "last"
45+
# name-separator = "-"
46+
# database = "" # store graphite data in this database
47+
48+
# Configure the collectd input.
49+
[collectd]
50+
enabled = false
51+
#address = "0.0.0.0" # If not set, is actually set to bind-address.
52+
#port = 25827
53+
#database = "collectd_database"
54+
#typesdb = "types.db"
55+
56+
# Configure UDP listener for series data.
57+
[udp]
58+
enabled = true
59+
#bind-address = "0.0.0.0"
60+
port = {udp_port}
61+
62+
# Broker configuration. Brokers are nodes which participate in distributed
63+
# consensus.
64+
[broker]
65+
# Where the Raft logs are stored. The user running InfluxDB will need read/write access.
66+
dir = "{broker_raft_dir}"
67+
port = {broker_port}
68+
69+
# Data node configuration. Data nodes are where the time-series data, in the form of
70+
# shards, is stored.
71+
[data]
72+
dir = "{broker_node_dir}"
73+
port = {broker_port}
74+
75+
# Auto-create a retention policy when a database is created. Defaults to true.
76+
retention-auto-create = true
77+
78+
# Control whether retention policies are enforced and how long the system waits between
79+
# enforcing those policies.
80+
retention-check-enabled = true
81+
retention-check-period = "10m"
82+
83+
[cluster]
84+
# Location for cluster state storage. For storing state persistently across restarts.
85+
dir = "{cluster_dir}"
86+
87+
[logging]
88+
file = "{logfile}" # Leave blank to redirect logs to stderr.
89+
write-tracing = false # If true, enables detailed logging of the write system.
90+
raft-tracing = false # If true, enables detailed logging of Raft consensus.
91+
92+
# InfluxDB can store statistics about itself. This is useful for monitoring purposes.
93+
# This feature is disabled by default, but if enabled, these statistics can be queried
94+
# as any other data.
95+
[statistics]
96+
enabled = false
97+
database = "internal" # The database to which the data is written.
98+
retention-policy = "default" # The retention policy within the database.
99+
write-interval = "1m" # Period between writing the data.
100+
101+
[snapshot]
102+
bind-address = "127.0.0.1"
103+
port = {snapshot_port}

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