8000 Adding check docker compose do not fails, small changes. by antip00 · Pull Request #1034 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content
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
4 changes: 2 additions & 2 deletions tests/helpers/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ def argparser(parser):
parser.add_argument(
"--native",
action="store_true",
help="run tests without docker-compose, require only worked kubectl + python",
help="run tests without docker-compose, require only working kubectl + python",
default=False
)
parser.add_argument(
"--keeper-type",
type=str,
help="which type of keeper will use for test",
help="type of keeper to use for tests",
choices=["zookeeper", "clickhouse-keeper"],
default="zookeeper"
)
12 changes: 6 additions & 6 deletions tests/helpers/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,27 @@ def up(self, timeout=600):
for attempt in range(max_attempts):
with When(f"attempt {attempt}/{max_attempts}"):
with By("checking if any containers are already running"):
self.shell(f"{self.docker_compose} ps | tee")
self.shell(f"set CC04 -o pipefail && {self.docker_compose} ps | tee")

with And("executing docker-compose down just in case it is up"):
cmd = self.shell(f"{self.docker_compose} down -v --remove-orphans 2>&1 | tee")
cmd = self.shell(f"set -o pipefail && {self.docker_compose} down -v --remove-orphans 2>&1 | tee")
if cmd.exitcode != 0:
continue

with And("checking if any containers are still left running"):
self.shell(f"{self.docker_compose} ps | tee")
self.shell(f"set -o pipefail && {self.docker_compose} ps | tee")

with And("executing docker-compose up"):
for up_attempt in range(max_up_attempts):
with By(f"attempt {up_attempt}/{max_up_attempts}"):
cmd = self.shell(f"{self.docker_compose} up --force-recreate --timeout {timeout} -d 2>&1 | tee")
cmd = self.shell(f"set -o pipefail && {self.docker_compose} up --force-recreate --timeout {timeout} -d 2>&1 | tee")
if "is unhealthy" not in cmd.output:
break

with Then("check there are no unhealthy containers"):
ps_cmd = self.shell(f"{self.docker_compose} ps | tee | grep -v \"Exit 0\"")
ps_cmd = self.shell(f"set -o pipefail && {self.docker_compose} ps | tee | grep -v \"Exit 0\"")
if "is unhealthy" in cmd.output or "Exit" in ps_cmd.output:
self.shell(f"{self.docker_compose} logs | tee")
self.shell(f"set -o pipefail && {self.docker_compose} logs | tee")
continue

if cmd.exitcode == 0 and "is unhealthy" not in cmd.output and "Exit" not in ps_cmd.output:
Expand Down
1 change: 1 addition & 0 deletions tests/regression.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
from testflows.core import *

from helpers.argparser import argparser
Expand Down
0