Skip to content

Commit d254dbb

Browse files
committed
update dns suite for package testing
1 parent 719e032 commit d254dbb

File tree

6 files changed

+33
-28
lines changed

6 files changed

+33
-28
lines changed

dns/dns_env/Dockerfile

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

dns/dns_env/clickhouse-service.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
version: '3'
1+
version: "3"
22

33
services:
44
clickhouse:
5-
build:
6-
context: .
7-
dockerfile: Dockerfile
5+
extends:
6+
file: ../../docker-compose/clickhouse-service.yml
7+
service: clickhouse
88
init: true
99
expose:
1010
- "9000"
@@ -14,7 +14,6 @@ services:
1414
- "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/docker_related_config.xml:/etc/clickhouse-server/config.d/docker_related_config.xml"
1515
- "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml"
1616
- "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml"
17-
- "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse"
1817
entrypoint: bash -c "tail -f /dev/null"
1918
healthcheck:
2019
test: echo 1

dns/dns_env/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ services:
4040
image: coredns/coredns:latest
4141
volumes:
4242
- "${CLICKHOUSE_TESTS_DIR}/tests/lookup/example.com:/etc/example.com"
43-
- "${CLICKHOUSE_TESTS_DIR}/tests/lookup/Corefile:/Corefile"
43+
- "${CLICKHOUSE_TESTS_DIR}/tests/lookup/Corefile:/Corefile"

dns/dns_env_arm64/Dockerfile

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

dns/dns_env_arm64/clickhouse-service.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
version: '3'
1+
version: "3"
22

33
services:
44
clickhouse:
5-
build:
6-
context: .
7-
dockerfile: Dockerfile
5+
extends:
6+
file: ../../docker-compose/clickhouse-service.yml
7+
service: clickhouse
88
init: true
99
expose:
1010
- "9000"
@@ -14,7 +14,6 @@ services:
1414
- "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/docker_related_config.xml:/etc/clickhouse-server/config.d/docker_related_config.xml"
1515
- "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml"
1616
- "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml"
17-
- "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse"
1817
entrypoint: bash -c "tail -f /dev/null"
1918
healthcheck:
2019
test: echo 1

dns/tests/lookup/scenario.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,20 @@ def scenario(self):
3939
)
4040
CLIENT_IP = cluster.command(None, query).output
4141

42-
with And("I am listening in the background to port 8123 and 53"):
43-
cluster.node("clickhouse1").command(
44-
"tcpdump -i any -w http_and_dns.pcap port 8123 or port 53 &"
45-
)
42+
with And("I try to install tcpdump"):
43+
tcpdump_available = False
44+
r = cluster.node("clickhouse1").command("apt-get update", no_checks=True)
45+
if r.exitcode == 0:
46+
cluster.node("clickhouse1").command(
47+
"apt-get install -y bind9-dnsutils tcpdump curl psmisc less"
48+
)
49+
tcpdump_available = True
50+
51+
if tcpdump_available:
52+
with And("I am listening in the background to port 8123 and 53"):
53+
cluster.node("clickhouse1").command(
54+
"tcpdump -i any -w http_and_dns.pcap port 8123 or port 53 &"
55+
)
4656

4757
with When("I write the CLIENT IP into example.com"):
4858
cluster.command(
@@ -68,16 +78,17 @@ def scenario(self):
6878
server_version = cluster.node("clickhouse1").query(f"SELECT version()").output
6979
assert client_version == server_version, error()
7080

71-
with When("I kill the background port listening"):
72-
cluster.node("clickhouse1").command("killall tcpdump")
81+
if tcpdump_available:
82+
with When("I kill the background port listening"):
83+
cluster.node("clickhouse1").command("killall tcpdump")
7384

74-
with And("I copy the http_and_dns.pcap file off of the docker container"):
75-
x = cluster.command(
76-
None, "docker ps | grep clickhouse1 | head -n 1 | cut -d ' ' -f 1"
77-
).output
78-
cluster.command(
79-
None, f"docker cp {x}:/http_and_dns.pcap regression/dns/tests/lookup/"
80-
)
85+
with And("I copy the http_and_dns.pcap file off of the docker container"):
86+
x = cluster.command(
87+
None, "docker ps | grep clickhouse1 | head -n 1 | cut -d ' ' -f 1"
88+
).output
89+
cluster.command(
90+
None, f"docker cp {x}:/http_and_dns.pcap regression/dns/tests/lookup/"
91+
)
8192

8293
with And("I update example.com with more urls."):
8394
cluster.command(

0 commit comments

Comments
 (0)