diff --git a/.travis.yml b/.travis.yml index d8c0a437..8c8b81d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/build_influxdb_server.sh b/build_influxdb_server.sh deleted file mode 100755 index 7b0bf957..00000000 --- a/build_influxdb_server.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -# -# build and install, -# the latest influxdb server master -# - -set -e - -tmpdir=$(mktemp -d) - -echo "Using tempdir $tmpdir .." - -cd "$tmpdir" - -# rpm for package.sh (below) which will also build an .rpm -sudo apt-get install ruby ruby-dev build-essential rpm - -echo $PATH -echo $(which gem) -echo $(which ruby) - -gem=$(which gem) - -sudo $gem install fpm - -mkdir -p go/src/github.com/influxdb -cd go/src/github.com/influxdb - -git clone --depth 5 https://github.com/influxdb/influxdb -cd influxdb - -version=0.0.0-$(git describe --always | sed 's/^v//') -echo "describe: $version" - -export GOPATH="$tmpdir/go" -{ echo y ; yes no ; } | ./package.sh "$version" - -deb=$(ls *.deb) -sudo dpkg -i "$deb" diff --git a/tests/influxdb/client_test_with_server.py b/tests/influxdb/client_test_with_server.py index dc8ad72f..968d234b 100644 --- a/tests/influxdb/client_test_with_server.py +++ b/tests/influxdb/client_test_with_server.py @@ -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() @@ -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( @@ -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: @@ -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): @@ -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') @@ -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 diff --git a/tests/influxdb/influxdb.conf.template b/tests/influxdb/influxdb.conf.template index dde1a4ae..82608f73 100644 --- a/tests/influxdb/influxdb.conf.template +++ b/tests/influxdb/influxdb.conf.template @@ -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 @@ -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. @@ -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} diff --git a/tests/influxdb/influxdb.udp_conf.template b/tests/influxdb/influxdb.udp_conf.template new file mode 100644 index 00000000..4134172f --- /dev/null +++ b/tests/influxdb/influxdb.udp_conf.template @@ -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