From 597eccfa23339e442bff0a5d26ddeb0d7c56a057 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 12 Dec 2024 07:47:37 +1100 Subject: [PATCH] Rebalanced tests. --- .vortex/tests/bats/workflow.install.bats | 108 ------------------ .../bats/workflow.install.db.rootweb.bats | 40 +++++++ .../bats/workflow.install.db.webroot.bats | 56 +++++++++ .../tests/bats/workflow.install.profile.bats | 30 +++++ .vortex/tests/test.workflow.sh | 8 +- 5 files changed, 132 insertions(+), 110 deletions(-) delete mode 100644 .vortex/tests/bats/workflow.install.bats create mode 100644 .vortex/tests/bats/workflow.install.db.rootweb.bats create mode 100644 .vortex/tests/bats/workflow.install.db.webroot.bats create mode 100644 .vortex/tests/bats/workflow.install.profile.bats diff --git a/.vortex/tests/bats/workflow.install.bats b/.vortex/tests/bats/workflow.install.bats deleted file mode 100644 index fb90fff47..000000000 --- a/.vortex/tests/bats/workflow.install.bats +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env bats -# -# Workflows using different types of install source. -# - -# shellcheck disable=SC2030,SC2031,SC2129 - -load _helper.bash -load _helper.workflow.bash - -@test "Workflow: DB-driven" { - prepare_sut "Starting DB-driven WORKFLOW tests in build directory ${BUILD_DIR}" - - assert_ahoy_download_db - - assert_ahoy_build - assert_gitignore - - assert_solr - - assert_ahoy_cli - - assert_env_changes - - assert_timezone - - assert_ahoy_composer - - assert_ahoy_drush - - assert_ahoy_info - - assert_ahoy_container_logs - - assert_ahoy_login - - assert_ahoy_export_db - - assert_ahoy_lint - - assert_ahoy_test - - assert_ahoy_fei - - assert_ahoy_fe - - assert_ahoy_debug - - # Run this test as a last one to make sure that there is no concurrency issues - # with enabled Redis. - assert_redis - - assert_ahoy_reset - - assert_ahoy_reset_hard -} - -@test "Workflow: DB-driven, custom webroot" { - prepare_sut "Starting DB-driven WORKFLOW with custom webroot tests in build directory ${BUILD_DIR}" "rootdoc" - - assert_ahoy_download_db - - assert_ahoy_build "rootdoc" - assert_gitignore "" "rootdoc" - - assert_ahoy_cli - - assert_env_changes - - assert_ahoy_drush - - assert_ahoy_info "rootdoc" - - assert_ahoy_export_db - - assert_ahoy_lint "rootdoc" - - assert_ahoy_test "rootdoc" "1" - - assert_ahoy_fei "rootdoc" - - assert_ahoy_fe "rootdoc" - - assert_ahoy_reset "rootdoc" - - assert_ahoy_reset_hard "rootdoc" -} - -@test "Workflow: profile-driven" { - rm -f .data/db.sql - export VORTEX_INSTALL_DEMO_SKIP=1 - assert_file_not_exists .data/db.sql - - prepare_sut "Starting fresh install WORKFLOW tests in build directory ${BUILD_DIR}" - # Assert that the database was not downloaded because VORTEX_INSTALL_DEMO_SKIP was set. - assert_file_not_exists .data/db.sql - - echo "VORTEX_PROVISION_USE_PROFILE=1" >>.env - - assert_ahoy_build - assert_gitignore - - assert_ahoy_lint - - assert_ahoy_test "web" "1" - - assert_ahoy_fe -} diff --git a/.vortex/tests/bats/workflow.install.db.rootweb.bats b/.vortex/tests/bats/workflow.install.db.rootweb.bats new file mode 100644 index 000000000..4b9d2e871 --- /dev/null +++ b/.vortex/tests/bats/workflow.install.db.rootweb.bats @@ -0,0 +1,40 @@ +#!/usr/bin/env bats +# +# Workflows using different types of install source. +# + +# shellcheck disable=SC2030,SC2031,SC2129 + +load _helper.bash +load _helper.workflow.bash + +@test "Workflow: DB-driven, custom webroot" { + prepare_sut "Starting DB-driven WORKFLOW with custom webroot tests in build directory ${BUILD_DIR}" "rootdoc" + + assert_ahoy_download_db + + assert_ahoy_build "rootdoc" + assert_gitignore "" "rootdoc" + + assert_ahoy_cli + + assert_env_changes + + assert_ahoy_drush + + assert_ahoy_info "rootdoc" + + assert_ahoy_export_db + + assert_ahoy_lint "rootdoc" + + assert_ahoy_test "rootdoc" "1" + + assert_ahoy_fei "rootdoc" + + assert_ahoy_fe "rootdoc" + + assert_ahoy_reset "rootdoc" + + assert_ahoy_reset_hard "rootdoc" +} diff --git a/.vortex/tests/bats/workflow.install.db.webroot.bats b/.vortex/tests/bats/workflow.install.db.webroot.bats new file mode 100644 index 000000000..63fb7d6e3 --- /dev/null +++ b/.vortex/tests/bats/workflow.install.db.webroot.bats @@ -0,0 +1,56 @@ +#!/usr/bin/env bats +# +# Workflows using different types of install source. +# + +# shellcheck disable=SC2030,SC2031,SC2129 + +load _helper.bash +load _helper.workflow.bash + +@test "Workflow: DB-driven" { + prepare_sut "Starting DB-driven WORKFLOW tests in build directory ${BUILD_DIR}" + + assert_ahoy_download_db + + assert_ahoy_build + assert_gitignore + + assert_solr + + assert_ahoy_cli + + assert_env_changes + + assert_timezone + + assert_ahoy_composer + + assert_ahoy_drush + + assert_ahoy_info + + assert_ahoy_container_logs + + assert_ahoy_login + + assert_ahoy_export_db + + assert_ahoy_lint + + assert_ahoy_test + + assert_ahoy_fei + + assert_ahoy_fe + + assert_ahoy_debug + + # Run this test as a last one to make sure that there is no concurrency issues + # with enabled Redis. + assert_redis + + assert_ahoy_reset + + assert_ahoy_reset_hard +} diff --git a/.vortex/tests/bats/workflow.install.profile.bats b/.vortex/tests/bats/workflow.install.profile.bats new file mode 100644 index 000000000..9bf373fc2 --- /dev/null +++ b/.vortex/tests/bats/workflow.install.profile.bats @@ -0,0 +1,30 @@ +#!/usr/bin/env bats +# +# Workflows using different types of install source. +# + +# shellcheck disable=SC2030,SC2031,SC2129 + +load _helper.bash +load _helper.workflow.bash + +@test "Workflow: profile-driven" { + rm -f .data/db.sql + export VORTEX_INSTALL_DEMO_SKIP=1 + assert_file_not_exists .data/db.sql + + prepare_sut "Starting fresh install WORKFLOW tests in build directory ${BUILD_DIR}" + # Assert that the database was not downloaded because VORTEX_INSTALL_DEMO_SKIP was set. + assert_file_not_exists .data/db.sql + + echo "VORTEX_PROVISION_USE_PROFILE=1" >>.env + + assert_ahoy_build + assert_gitignore + + assert_ahoy_lint + + assert_ahoy_test "web" "1" + + assert_ahoy_fe +} diff --git a/.vortex/tests/test.workflow.sh b/.vortex/tests/test.workflow.sh index 614b4394c..f9385e198 100755 --- a/.vortex/tests/test.workflow.sh +++ b/.vortex/tests/test.workflow.sh @@ -43,14 +43,16 @@ case ${index} in 0) bats "${TEST_DIR}"/bats/workflow.smoke.bats bats "${TEST_DIR}"/bats/workflow.storage.curl.bats + bats "${TEST_DIR}"/bats/workflow.install.profile.bats ;; 1) - bats "${TEST_DIR}"/bats/workflow.install.bats + bats "${TEST_DIR}"/bats/workflow.install.webroot.bats ;; 2) bats "${TEST_DIR}"/bats/workflow.utilities.bats + bats "${TEST_DIR}"/bats/workflow.install.rootweb.bats # Disabled due to intermittent failures. # @see https://github.com/drevops/vortex/issues/893 # bats "${TEST_DIR}"/bats/workflow.storage.image_cached.bats @@ -59,7 +61,9 @@ case ${index} in *) bats "${TEST_DIR}"/bats/workflow.smoke.bats - bats "${TEST_DIR}"/bats/workflow.install.bats + bats "${TEST_DIR}"/bats/workflow.install.webroot.bats + bats "${TEST_DIR}"/bats/workflow.install.rootweb.bats + bats "${TEST_DIR}"/bats/workflow.install.profile.bats bats "${TEST_DIR}"/bats/workflow.storage.image.bats # Disabled due to intermittent failures. # @see https://github.com/drevops/vortex/issues/893