Skip to content

Commit 00913fa

Browse files
author
Grégory Starck
committed
Add: also set a snapshot port in test config templates
1 parent d465a91 commit 00913fa

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

tests/influxdb/client_test_with_server.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,26 @@ def __init__(self, conf_template):
116116
self.temp_dir_base = tempfile.mkdtemp()
117117
# "temp_dir_base" will be used for conf file and logs,
118118
# while "temp_dir_influxdb" is for the databases files/dirs :
119-
self.temp_dir_influxdb = tempfile.mkdtemp(
119+
tempdir = self.temp_dir_influxdb = tempfile.mkdtemp(
120120
dir=self.temp_dir_base)
121121
# we need some "free" ports :
122122
self.broker_port = get_free_port()
123123
self.admin_port = get_free_port()
124-
# as it's UDP we can reuse the same port as the broker:
125124
self.udp_port = get_free_port()
125+
self.snapshot_port = get_free_port()
126126

127-
self.logs_file = os.path.join(
128-
self.temp_dir_base, 'logs.txt')
127+
self.logs_file = os.path.join(self.temp_dir_base, 'logs.txt')
129128

130129
with open(conf_template) as fh:
131130
conf = fh.read().format(
132131
broker_port=self.broker_port,
133132
admin_port=self.admin_port,
134133
udp_port=self.udp_port,
135-
broker_raft_dir=os.path.join(
136-
self.temp_dir_influxdb, 'raft'),
137-
broker_node_dir=os.path.join(
138-
self.temp_dir_influxdb, 'db'),
139-
influxdb_cluster_dir=os.path.join(
140-
self.temp_dir_influxdb, 'state'),
141-
influxdb_logfile=self.logs_file
134+
broker_raft_dir=os.path.join(tempdir, 'raft'),
135+
broker_node_dir=os.path.join(tempdir, 'db'),
136+
cluster_dir=os.path.join(tempdir, 'state'),
137+
logfile=self.logs_file,
138+
snapshot_port=self.snapshot_port,
142139
)
143140

144141
conf_file = os.path.join(self.temp_dir_base, 'influxdb.conf')

tests/influxdb/influxdb.conf.template

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ port = {broker_port}
8282

8383
[cluster]
8484
# Location for cluster state storage. For storing state persistently across restarts.
85-
dir = "{influxdb_cluster_dir}"
85+
dir = "{cluster_dir}"
8686

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

@@ -97,3 +97,8 @@ enabled = false
9797
database = "internal" # The database to which the data is written.
9898
retention-policy = "default" # The retention policy within the database.
9999
write-interval = "1m" # Period between writing the data.
100+
101+
102+
[snapshot]
103+
bind-address = "127.0.0.1"
104+
port = {snapshot_port}

tests/influxdb/influxdb.udp_conf.template

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ port = {broker_port}
8282

8383
[cluster]
8484
# Location for cluster state storage. For storing state persistently across restarts.
85-
dir = "{influxdb_cluster_dir}"
85+
dir = "{cluster_dir}"
8686

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

@@ -97,3 +97,7 @@ enabled = false
9797
database = "internal" # The database to which the data is written.
9898
retention-policy = "default" # The retention policy within the database.
9999
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