Skip to content

Commit

Permalink
switch testflows from docker-compose to docker compose, fix TestS3NoD…
Browse files Browse the repository at this point in the history
…eletePermission
  • Loading branch information
Slach committed Aug 1, 2024
1 parent c56d685 commit 5f3a379
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ jobs:
set -x
export CLICKHOUSE_TESTS_DIR=$(pwd)/test/testflows/clickhouse_backup
command -v docker-compose || (apt-get update && apt-get install -y python3-pip && pip3 install -U docker-compose)
docker-compose -f ${CLICKHOUSE_TESTS_DIR}/docker-compose/docker-compose.yml pull
docker compose -f ${CLICKHOUSE_TESTS_DIR}/docker-compose/docker-compose.yml pull
chmod +x $(pwd)/clickhouse-backup/clickhouse-backup*
source ~/venv/qa/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion test/integration/minio_nodelete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ EOF
)

mc admin policy attach local nodelete --user nodelete
mc alias set nodelete http://localhost:9000 nodelete nodelete_password
mc alias set nodelete https://localhost:9000 nodelete nodelete_password
mc alias list
2 changes: 1 addition & 1 deletion test/testflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To execute tests, you will need:
* Python 3.8 or higher (`python3`)
* The latest version of Go (`https://go.dev/doc/install`)
* TestFlows Python library (`https://testflows.com/`)
* `docker` and `docker-compose`
* `docker` and `docker compose`

To install all necessary Python packages, execute:
```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ services:
start_period: 15s

# dummy service which does nothing, but allows to postpone
# 'docker-compose up -d' till all dependencies will go healthy
# 'docker compose up -d' till all dependencies will go healthy
all_services_ready:
image: hello-world
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion test/testflows/clickhouse_backup/tests/other_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def kafka_engine(self):
assert f"{name_prefix}" in r, error()

finally:
with Finally("I bring up docker-compose to restore all services"):
with Finally("I bring up docker compose to restore all services"):
command = f'{cluster.docker_compose} up -d --no-recreate 2>&1 | tee'
cluster.command(None, command)

Expand Down
2 changes: 1 addition & 1 deletion test/testflows/helpers/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ def argparser(parser):
"""
parser.add_argument("--local",
action="store_true",
help="run regression in local mode without docker-compose down", default=True)
help="run regression in local mode without docker compose down", default=True)
20 changes: 10 additions & 10 deletions test/testflows/helpers/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __exit__(self, shell_type, shell_value, traceback):
# to terminate any open shell commands.
# This is needed for example
# to solve a problem with
# 'docker-compose exec {name} bash --noediting'
# 'docker compose exec {name} bash --noediting'
# that does not clean up open bash processes
# if not exited normally
for i in range(10):
Expand Down Expand Up @@ -407,13 +407,13 @@ def query(self, sql, expect_message=None, exitcode=None, steps=True, no_checks=F


class Cluster(object):
"""Simple object around docker-compose cluster.
"""Simple object around docker compose cluster.
"""

def __init__(self, local=False,
configs_dir=None,
nodes=None,
docker_compose="docker-compose", docker_compose_project_dir=None,
docker_compose="docker compose", docker_compose_project_dir=None,
docker_compose_file="docker-compose.yml",
environ=None):

Expand Down Expand Up @@ -611,7 +611,7 @@ def close_bash(self, node):
del self.shells[shell_id]

def __enter__(self):
with Given("docker-compose cluster"):
with Given("docker compose cluster"):
self.up()
return self

Expand All @@ -633,7 +633,7 @@ def node(self, node_name):
return Node(self, node_name)

def down(self, timeout=300):
"""Bring cluster down by executing docker-compose down."""
"""Bring cluster down by executing docker compose down."""

# add message to each clickhouse-server.log
if settings.debug:
Expand Down Expand Up @@ -690,7 +690,7 @@ def up(self, timeout=120):
with And("I list environment variables to show their values"):
self.command(None, "env | grep CLICKHOUSE")

with Given("docker-compose"):
with Given("docker compose"):
max_attempts = 5
max_up_attempts = 1

Expand All @@ -699,17 +699,17 @@ def up(self, timeout=120):
with By("checking if any containers are already running"):
self.command(None, f"{self.docker_compose} ps | tee")

with And("executing docker-compose down just in case it is up"):
with And("executing docker compose down just in case it is up"):
cmd = self.command(
None, f"{self.docker_compose} down --timeout=10 2>&1 | tee", exitcode=None, timeout=timeout
None, f"{self.docker_compose} down --timeout=1 2>&1 | tee", exitcode=None, timeout=timeout
)
if cmd.exitcode != 0:
continue

with And("checking if any containers are still left running"):
self.command(None, f"{self.docker_compose} ps | tee")

with And("executing docker-compose up"):
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.command(
Expand All @@ -728,7 +728,7 @@ def up(self, timeout=120):
break

if cmd.exitcode != 0 or "is unhealthy" in cmd.output or "Exit" in ps_cmd.output:
fail("could not bring up docker-compose cluster")
fail("could not bring up docker compose cluster")

with Then("wait all nodes report healthy"):
for node_name in self.nodes["clickhouse"]:
Expand Down

0 comments on commit 5f3a379

Please sign in to comment.