From 735d156c8e3919913d7d160bb9705b14133752ae Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 7 Apr 2022 12:07:29 -0600 Subject: [PATCH] docker-compose: Add wait mode Instead of scheduling the teuthology:no-ceph suite and then exiting when it finishes, schedule nothing and don't exit automatically. This allows running whatever - and however many - tests are desired. Signed-off-by: Zack Cerza --- docs/docker-compose/README.md | 21 +++++++++-- docs/docker-compose/docker-compose.yml | 1 + docs/docker-compose/start.sh | 11 ++++-- docs/docker-compose/teuthology/teuthology.sh | 37 +++++++++++--------- 4 files changed, 47 insertions(+), 23 deletions(-) diff --git a/docs/docker-compose/README.md b/docs/docker-compose/README.md index e0760677db..94ee3e4caa 100644 --- a/docs/docker-compose/README.md +++ b/docs/docker-compose/README.md @@ -5,7 +5,7 @@ up a development environment for Teuthology. We will be using Docker to set up all the containers for Postgres, Paddles, Pulpito, Beanstalk, and Teuthology. -Currently, there are two modes of execution: +Currently, it's possible to execute against two classes of test nodes: * [Using containerized test nodes](#containers) * Advantage: No need for a lab at all! @@ -14,7 +14,12 @@ Currently, there are two modes of execution: * Advantage: Can run all Ceph tests * Disadvantage: Requires lab access -In both cases, the teuthology container will be built with code from the repository clone that's currently in use. + +Additionally, there are two modes of execution: +* One-shot (the default): Containers start up, schedule and run the `teuthology:no-ceph` suite, and shut down. Success or failure is indicated by the `start.sh` exit code. +* Wait: Containers start up, and `teuthology-dispatcher` is started, but no jobs are scheduled. Runs until the user presses Ctrl-C or `docker-compose down` is run. + +The teuthology container will be built with code from the repository clone that's currently in use. ## Prerequisites @@ -72,7 +77,17 @@ This repo will be cloned locally, using your existing `git` configuration, and c ## Running Tests {#running} -When you are ready to run tests: +To run the default `teuthology:no-ceph` suite in one-shot mode: ```bash ./start.sh +``` + +To run in wait mode: +```bash +TEUTHOLOGY_WAIT=1 ./start.sh +``` + +To schedule tests in wait mode: +```bash +docker exec docker-compose_teuthology_1 /venv/bin/teuthology-suite ... ``` \ No newline at end of file diff --git a/docs/docker-compose/docker-compose.yml b/docs/docker-compose/docker-compose.yml index 1a049efd4f..ba770fef63 100644 --- a/docs/docker-compose/docker-compose.yml +++ b/docs/docker-compose/docker-compose.yml @@ -75,6 +75,7 @@ services: SSH_PRIVKEY_FILE: MACHINE_TYPE: TESTNODES: + TEUTHOLOGY_WAIT: testnode: build: context: ./testnode diff --git a/docs/docker-compose/start.sh b/docs/docker-compose/start.sh index 0c9ba89b6e..4aebd22660 100755 --- a/docs/docker-compose/start.sh +++ b/docs/docker-compose/start.sh @@ -33,10 +33,15 @@ else export SSH_PRIVKEY_FILE=$(basename $SSH_PRIVKEY_PATH | cut -d. -f1) fi +if [ -z "$TEUTHOLOGY_WAIT" ]; then + DC_EXIT_FLAG='--abort-on-container-exit --exit-code-from teuthology' + DC_AUTO_DOWN_CMD='docker-compose down' +fi +export TEUTHOLOGY_WAIT + set +e trap "docker-compose down" SIGINT docker-compose up \ --build \ - --abort-on-container-exit \ - --exit-code-from teuthology -docker-compose down \ No newline at end of file + $DC_EXIT_FLAG +$DC_AUTO_DOWN_CMD \ No newline at end of file diff --git a/docs/docker-compose/teuthology/teuthology.sh b/docs/docker-compose/teuthology/teuthology.sh index e9e32b0dfb..d3e6b5d745 100755 --- a/docs/docker-compose/teuthology/teuthology.sh +++ b/docs/docker-compose/teuthology/teuthology.sh @@ -14,23 +14,26 @@ else CUSTOM_CONF=/teuthology/containerized_node.yaml fi export MACHINE_TYPE=${MACHINE_TYPE:-testnode} -teuthology-suite -v \ - --ceph-repo https://github.com/ceph/ceph.git \ - --suite-repo https://github.com/ceph/ceph.git \ - -c master \ - -m $MACHINE_TYPE \ - --limit 1 \ - -n 100 \ - --suite teuthology:no-ceph \ - --filter-out "libcephfs,kclient,stream,centos,rhel" \ - -d ubuntu -D 20.04 \ - --suite-branch master \ - --subset 9000/100000 \ - -p 75 \ - --seed 349 \ - --force-priority \ - $CUSTOM_CONF +if [ -z "$TEUTHOLOGY_WAIT" ]; then + teuthology-suite -v \ + --ceph-repo https://github.com/ceph/ceph.git \ + --suite-repo https://github.com/ceph/ceph.git \ + -c master \ + -m $MACHINE_TYPE \ + --limit 1 \ + -n 100 \ + --suite teuthology:no-ceph \ + --filter-out "libcephfs,kclient,stream,centos,rhel" \ + -d ubuntu -D 20.04 \ + --suite-branch master \ + --subset 9000/100000 \ + -p 75 \ + --seed 349 \ + --force-priority \ + $CUSTOM_CONF + DISPATCHER_EXIT_FLAG='--exit-on-empty-queue' +fi teuthology-dispatcher -v \ --log-dir /teuthology/log \ --tube $MACHINE_TYPE \ - --exit-on-empty-queue \ No newline at end of file + $DISPATCHER_EXIT_FLAG \ No newline at end of file -- 2.39.5