From 677ac3f5c3e62be3ff1fa0c133990ca1e9db36e7 Mon Sep 17 00:00:00 2001 From: Bas Date: Mon, 4 Nov 2024 11:08:39 +0100 Subject: [PATCH] Cleanup duplicate behat docker compose config --- .github/workflows/stepup-behat.yml | 6 +-- stepup/docker-compose-behat.yml | 12 ------ stepup/docs/functional-testing.md | 42 ------------------- stepup/start-dev-env.sh | 1 - .../features/bootstrap/FeatureContext.php | 10 ++--- 5 files changed, 8 insertions(+), 63 deletions(-) delete mode 100644 stepup/docker-compose-behat.yml delete mode 100644 stepup/docs/functional-testing.md diff --git a/.github/workflows/stepup-behat.yml b/.github/workflows/stepup-behat.yml index 7d865fd..368bf2a 100644 --- a/.github/workflows/stepup-behat.yml +++ b/.github/workflows/stepup-behat.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 env: - DOCKER_COMPOSE: docker compose -f docker-compose.yml -f docker-compose-behat.yml + DOCKER_COMPOSE: docker compose -f docker-compose.yml steps: - name: Checkout uses: actions/checkout@v1 @@ -30,13 +30,13 @@ jobs: - name: Install composer dependencies on the Behat container run: | cd stepup - ${DOCKER_COMPOSE} exec -T behat bash -lc "composer install --ignore-platform-reqs -n" + ${DOCKER_COMPOSE} exec behat composer install --ignore-platform-reqs -n - name: Sleep for 10 seconds run: sleep 10s - name: Run Behat tests run: | cd stepup - docker exec -t stepup-behat-1 bash -lc "./behat" + ${DOCKER_COMPOSE} exec behat ./vendor/bin/behat --config config/behat.yml - name: Output logs on failure if: failure() run: | diff --git a/stepup/docker-compose-behat.yml b/stepup/docker-compose-behat.yml deleted file mode 100644 index cbe6150..0000000 --- a/stepup/docker-compose-behat.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -services: - - behat: - image: ghcr.io/openconext/openconext-devconf/openconext-devconf:test - environment: - - APP_ENV=${APP_ENV:-prod} - networks: - openconextdev: - volumes: - - ${PWD}/:/config - - /var/run/docker.sock:/var/run/docker.sock diff --git a/stepup/docs/functional-testing.md b/stepup/docs/functional-testing.md deleted file mode 100644 index 93953de..0000000 --- a/stepup/docs/functional-testing.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Get the tests up and running -The stepup directory is mounted in /config. All tests are present in this directory. -All the Stepup containers have a test variant available. These are tagged with :test eg: - -``` -ghcr.io/openconext/stepup-gateway/stepup-gateway:test -``` - -These are automatically started when the correct variable is set in the .env in the directory where docker-compose.yml is located. -An environment file is provided. Copy it into place to use it: -``` -cp .env.test .env -``` - -You can the start the environment in test mode (APP_ENV=smoketest does the magic inside the containers) -A seperate behat container is provided. It is defined in a docker compose override file. Start it like this: -``` -docker compose -f docker-compose.yml -f docker-compose-behat.yml up -d -``` - -You can now use the shell inside the behat container to start the behat tests. - -Enter the container: -``` -docker compose exec -ti behat bash -``` - -Now you need to install behat -``` -composer install --ignore-platform-req=ext-bcmath -``` -And you can now run the tests -``` -vendor/behat/behat/bin/behat -``` -TODO -- The bootstrap process is not working as it should. The renaming of stepup.example.com to dev.openconext.local might be an issue -- Make start-dev-env.sh compatible by adding a commandline option to start the environment in smoketest mode -- Think of a way to do this in GitHub actions -- Make the logging in all containers docker compatible (log to stdout) - diff --git a/stepup/start-dev-env.sh b/stepup/start-dev-env.sh index 667a33e..f945d15 100755 --- a/stepup/start-dev-env.sh +++ b/stepup/start-dev-env.sh @@ -13,7 +13,6 @@ else fi if [ "${STEPUP_VERSION}" == "test" ]; then - extra_compose_args="-f docker-compose-behat.yml" MODE="test" echo -e "${GREEN}Starting in test mode${ENDCOLOR}" else diff --git a/stepup/tests/behat/features/bootstrap/FeatureContext.php b/stepup/tests/behat/features/bootstrap/FeatureContext.php index bf60f10..74064c6 100644 --- a/stepup/tests/behat/features/bootstrap/FeatureContext.php +++ b/stepup/tests/behat/features/bootstrap/FeatureContext.php @@ -51,17 +51,17 @@ public static function setupDatabase(BeforeFeatureScope $scope) { // Generate test databases echo "Preparing test schemas\n"; - shell_exec("docker exec -it stepup-middleware-1 bin/console doctrine:schema:drop --env=smoketest --force"); - shell_exec("docker exec -it stepup-gateway-1 bin/console doctrine:schema:drop --env=smoketest --force"); - shell_exec("docker exec -it stepup-middleware-1 bin/console doctrine:schema:create --env=smoketest"); - shell_exec("docker exec -it stepup-gateway-1 bin/console doctrine:schema:create --env=smoketest"); + shell_exec("docker exec -t stepup-middleware-1 bin/console doctrine:schema:drop --env=smoketest --force"); + shell_exec("docker exec -t stepup-gateway-1 bin/console doctrine:schema:drop --env=smoketest --force"); + shell_exec("docker exec -t stepup-middleware-1 bin/console doctrine:schema:create --env=smoketest"); + shell_exec("docker exec -t stepup-gateway-1 bin/console doctrine:schema:create --env=smoketest"); echo "Replaying event stream\n"; // Import the events.sql into middleware shell_exec("mysql -uroot -psecret middleware_test -h mariadb < ./fixtures/events.sql"); shell_exec("./fixtures/middleware-push-config.sh"); // Perform an event replay - shell_exec("docker exec -ti stepup-middleware-1 bin/console middleware:event:replay --env=smoketest_event_replay --no-interaction -q"); + shell_exec("docker exec -t stepup-middleware-1 bin/console middleware:event:replay --env=smoketest_event_replay --no-interaction -q"); } /**