Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Revert "Sync tests against last master update" #155

Merged
merged 2 commits into from
Apr 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
install:
- sudo pip install tox
- sudo pip install coveralls
- ./build_influxdb_server.sh
- wget http://get.influxdb.org/influxdb_0.9.0-rc18_amd64.deb && sudo dpkg -i influxdb_0.9.0-rc18_amd64.deb
script:
- travis_wait tox -e $TOX_ENV
after_success:
Expand Down
40 changes: 0 additions & 40 deletions build_influxdb_server.sh

This file was deleted.

63 changes: 27 additions & 36 deletions tests/influxdb/client_test_with_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class InfluxDbInstance(object):
in a temporary place, using a config file template.
'''

def __init__(self, conf_template, udp_enabled=False):
def __init__(self, conf_template):
# create a temporary dir to store all needed files
# for the influxdb server instance :
self.temp_dir_base = tempfile.mkdtemp()
Expand All @@ -142,28 +142,28 @@ def __init__(self, conf_template, udp_enabled=False):
tempdir = self.temp_dir_influxdb = tempfile.mkdtemp(
dir=self.temp_dir_base)
# we need some "free" ports :

ports = dict(
broker_port=get_free_port(),
webui_port=get_free_port(),
admin_port=get_free_port(),
udp_port=get_free_port() if udp_enabled else -1,
)

conf_data = dict(
broker_raft_dir=os.path.join(tempdir, 'raft'),
broker_node_dir=os.path.join(tempdir, 'db'),
cluster_dir=os.path.join(tempdir, 'state'),
logs_file=os.path.join(self.temp_dir_base, 'logs.txt'),
udp_enabled='true' if udp_enabled else 'false',
)
conf_data.update(ports)
self.__dict__.update(conf_data)
self.broker_port = get_free_port()
self.admin_port = get_free_port()
self.udp_port = get_free_port()
self.snapshot_port = get_free_port()

self.logs_file = os.path.join(self.temp_dir_base, 'logs.txt')

with open(conf_template) as fh:
conf = fh.read().format(
broker_port=self.broker_port,
admin_port=self.admin_port,
udp_port=self.udp_port,
broker_raft_dir=os.path.join(tempdir, 'raft'),
broker_node_dir=os.path.join(tempdir, 'db'),
cluster_dir=os.path.join(tempdir, 'state'),
logfile=self.logs_file,
snapshot_port=self.snapshot_port,
)

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

# now start the server instance:
proc = self.proc = subprocess.Popen(
Expand All @@ -182,13 +182,8 @@ def __init__(self, conf_template, udp_enabled=False):
# or you run a 286 @ 1Mhz ?
try:
while time.time() < timeout:
if (is_port_open(self.webui_port)
if (is_port_open(self.broker_port)
and is_port_open(self.admin_port)):
# it's hard to check if a UDP port is open..
if udp_enabled:
# so let's just sleep 0.5 sec in this case
# to be sure that the server has open the port
time.sleep(0.5)
break
time.sleep(0.5)
if proc.poll() is not None:
Expand All @@ -197,13 +192,13 @@ def __init__(self, conf_template, udp_enabled=False):
proc.terminate()
proc.wait()
raise RuntimeError('Timeout waiting for influxdb to listen'
' on its ports (%s)' % ports)
' on its broker port')
except RuntimeError as err:
data = self.get_logs_and_output()
data['reason'] = str(err)
data['now'] = datetime.datetime.now()
raise RuntimeError("%(now)s > %(reason)s. RC=%(rc)s\n"
"stdout=%(out)s\nstderr=%(err)s\nlogs=%(logs)r"
"stdout=%(out)r\nstderr=%(err)r\nlogs=%(logs)r"
% data)

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


def _setup_influxdb_server(inst):
inst.influxd_inst = InfluxDbInstance(
inst.influxdb_template_conf,
udp_enabled=getattr(inst, 'influxdb_udp_enabled', False))
inst.influxd_inst = InfluxDbInstance(inst.influxdb_template_conf)
inst.cli = InfluxDBClient('localhost',
inst.influxd_inst.webui_port,
inst.influxd_inst.broker_port,
'root', '', database='db')


Expand Down Expand Up @@ -660,14 +653,12 @@ def test_tags_json_order(self):
class UdpTests(ManyTestCasesWithServerMixin,
unittest.TestCase):

influxdb_udp_enabled = True

influxdb_template_conf = os.path.join(THIS_DIR,
'influxdb.conf.template')
'influxdb.udp_conf.template')

def test_write_points_udp(self):
cli = InfluxDBClient(
'localhost', self.influxd_inst.webui_port,
'localhost', self.influxd_inst.broker_port,
'dont', 'care',
database='db',
use_udp=True, udp_port=self.influxd_inst.udp_port
Expand Down
59 changes: 29 additions & 30 deletions tests/influxdb/influxdb.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# that can be resolved here.
# hostname = ""
bind-address = "0.0.0.0"
port = {webui_port}

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

# Controls settings for initial start-up. Once a node a successfully started,
# these settings are ignored.
[initialization]
join-urls = "" # Comma-delimited URLs, in the form http://host:port, for joining another cluster.

# Control authentication
# If not set authetication is DISABLED. Be sure to explicitly set this flag to
# true if you want authentication.
Expand Down Expand Up @@ -49,57 +53,52 @@ enabled = false
#database = "collectd_database"
#typesdb = "types.db"

# Configure the OpenTSDB input.
[opentsdb]
enabled = false
#address = "0.0.0.0" # If not set, is actually set to bind-address.
#port = 4242
#database = "opentsdb_database"

# Configure UDP listener for series data.
[udp]
enabled = {udp_enabled}
enabled = false
#bind-address = "0.0.0.0"
#port = 4444
port = {udp_port}

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

# Data node configuration. Data nodes are where the time-series data, in the form of
# shards, is stored.
[data]
enabled = true
#dir = "/var/opt/influxdb/db"
dir = "{broker_node_dir}"
dir = "{broker_node_dir}"
port = {broker_port}

# Auto-create a retention policy when a database is created. Defaults to true.
retention-auto-create = true
# Auto-create a retention policy when a database is created. Defaults to true.
retention-auto-create = true

# Control whether retention policies are enforced and how long the system waits between
# enforcing those policies.
retention-check-enabled = true
retention-check-period = "10m"
# Control whether retention policies are enforced and how long the system waits between
# enforcing those policies.
retention-check-enabled = true
retention-check-period = "10m"

# Configuration for snapshot endpoint.
[snapshot]
enabled = false # Enabled by default if not set.
bind-address = "127.0.0.1"
port = 8087
[cluster]
# Location for cluster state storage. For storing state persistently across restarts.
dir = "{cluster_dir}"

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

# InfluxDB can store statistical and diagnostic information about itself. This is useful for
# monitoring purposes. This feature is disabled by default, but if enabled, these data can be
# queried like any other data.
[monitoring]
# InfluxDB can store statistics about itself. This is useful for monitoring purposes.
# This feature is disabled by default, but if enabled, these statistics can be queried
# as any other data.
[statistics]
enabled = false
database = "internal" # The database to which the data is written.
retention-policy = "default" # The retention policy within the database.
write-interval = "1m" # Period between writing the data.


[snapshot]
bind-address = "127.0.0.1"
port = {snapshot_port}
103 changes: 103 additions & 0 deletions tests/influxdb/influxdb.udp_conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Welcome to the InfluxDB configuration file.

# If hostname (on the OS) doesn't return a name that can be resolved by the other
# systems in the cluster, you'll have to set the hostname to an IP or something
# that can be resolved here.
# hostname = ""
bind-address = "0.0.0.0"

# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
# The data includes raft id (random 8 bytes), os, arch and version
# We don't track ip addresses of servers reporting. This is only used
# to track the number of instances running and the versions, which
# is very helpful for us.
# Change this option to true to disable reporting.
reporting-disabled = false

# Controls settings for initial start-up. Once a node a successfully started,
# these settings are ignored.
[initialization]
join-urls = "" # Comma-delimited URLs, in the form http://host:port, for joining another cluster.

# Control authentication
# If not set authetication is DISABLED. Be sure to explicitly set this flag to
# true if you want authentication.
[authentication]
enabled = false

# Configure the admin server
[admin]
enabled = true
port = {admin_port}

# Configure the HTTP API endpoint. All time-series data and queries uses this endpoint.
[api]
# ssl-port = 8087 # SSL support is enabled if you set a port and cert
# ssl-cert = "/path/to/cert.pem"

# Configure the Graphite plugins.
[[graphite]] # 1 or more of these sections may be present.
enabled = false
# protocol = "" # Set to "tcp" or "udp"
# address = "0.0.0.0" # If not set, is actually set to bind-address.
# port = 2003
# name-position = "last"
# name-separator = "-"
# database = "" # store graphite data in this database

# Configure the collectd input.
[collectd]
enabled = false
#address = "0.0.0.0" # If not set, is actually set to bind-address.
#port = 25827
#database = "collectd_database"
#typesdb = "types.db"

# Configure UDP listener for series data.
[udp]
enabled = true
#bind-address = "0.0.0.0"
port = {udp_port}

# Broker configuration. Brokers are nodes which participate in distributed
# consensus.
[broker]
# Where the Raft logs are stored. The user running InfluxDB will need read/write access.
dir = "{broker_raft_dir}"
port = {broker_port}

# Data node configuration. Data nodes are where the time-series data, in the form of
# shards, is stored.
[data]
dir = "{broker_node_dir}"
port = {broker_port}

# Auto-create a retention policy when a database is created. Defaults to true.
retention-auto-create = true

# Control whether retention policies are enforced and how long the system waits between
# enforcing those policies.
retention-check-enabled = true
retention-check-period = "10m"

[cluster]
# Location for cluster state storage. For storing state persistently across restarts.
dir = "{cluster_dir}"

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

# InfluxDB can store statistics about itself. This is useful for monitoring purposes.
# This feature is disabled by default, but if enabled, these statistics can be queried
# as any other data.
[statistics]
enabled = false
database = "internal" # The database to which the data is written.
retention-policy = "default" # The retention policy within the database.
write-interval = "1m" # Period between writing the data.

[snapshot]
bind-address = "127.0.0.1"
port = {snapshot_port}
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