From 7a02351ef1a87cc42e88318c5de3bcae2c039517 Mon Sep 17 00:00:00 2001
From: Bart Jaskulski <bjaskulski@protonmail.com>
Date: Wed, 7 Aug 2024 21:26:01 +0200
Subject: [PATCH] feat: remove smoke tests

Smoke tests in this configuration doesn't make much sense, as in fact it
is just an outdated version of regular codeception acceptance tests. The
purpose of smoke tests is to randomize access or patterns of plugin
usage and this is not fulfilled by this job. Instead, it only is
a maintenance burden, when requiring an update.

Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com>
---
 gitlab-ci-1.2.yml                    |  2 -
 includes/tests/codeception-smoke.yml | 93 ----------------------------
 2 files changed, 95 deletions(-)
 delete mode 100644 includes/tests/codeception-smoke.yml

diff --git a/gitlab-ci-1.2.yml b/gitlab-ci-1.2.yml
index 04d155f..8396f7e 100644
--- a/gitlab-ci-1.2.yml
+++ b/gitlab-ci-1.2.yml
@@ -20,7 +20,6 @@ stages:
   - tools
   - tests
   - pre-deploy
-  - smoke-tests
   - deploy
   - post-deploy
 
@@ -38,7 +37,6 @@ include:
       - '/includes/tests/codeception-integration.yml'
       - '/includes/tests/codeception.yml'
       - '/includes/tests/codeception-parallel.yml'
-      - '/includes/tests/codeception-smoke.yml'
       - '/includes/tests/integration.yml'
       - '/includes/deploy.yml'
       - '/includes/pages.yml'
diff --git a/includes/tests/codeception-smoke.yml b/includes/tests/codeception-smoke.yml
deleted file mode 100644
index bc1b086..0000000
--- a/includes/tests/codeception-smoke.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-.template: &job-codeception-smoke-test
-  tags:
-    - codeception
-    - $TESTS_TAG
-  image: wpdesknet/wordpresscli:25
-  needs:
-    - prepare prefixed vendor
-    - build to deploy
-    - job: prepare tests
-      optional: true
-    - job: prepare npm assets
-      optional: true
-  variables:
-    WP_CLI_CACHE_DIR: /cache/wp-cli
-    APACHE_DOCUMENT_ROOT: ${CI_PROJECT_DIR}/tests/wordpress
-    SCREEN_WIDTH: 1200
-    SCREEN_HEIGHT: 1200
-  services:
-    - name: mysql:5.6
-      alias: mysqltests
-      command: [--max-allowed-packet=67108864]
-    - name: wpdesknet/wordpress:52
-      alias: wootests
-    - name: selenium/standalone-chrome:latest
-      alias: chrome
-  artifacts:
-    when: always
-    expire_in: 1 month
-    name: "acceptance logs"
-    paths:
-      - tests/codeception/tests/_output
-    reports:
-      junit: tests/codeception/tests/_output/report.xml
-  stage: smoke-tests
-  except:
-    variables:
-      - $DISABLE_CODECEPTION
-      - $DISABLE_SMOKE_TESTS
-      - $IS_LIBRARY
-      - $IS_NPM_LIBRARY
-  allow_failure: false
-  interruptible: true
-  before_script:
-    - export DEPENDENT_PLUGINS_DIR=${CI_PROJECT_DIR}/tests/dependent_plugins
-    - mkdir -p /cache/wp-cli
-    - export MYSQL_IP=$(awk '/^[[:space:]]*($|#)/{next} /mysqltests/{print $1; exit}' /etc/hosts)
-    - export WOOTESTS_IP=$(awk '/^[[:space:]]*($|#)/{next} /wootests/{print $1; exit}' /etc/hosts)
-    - export TEST_SITE_WP_URL="http://${WOOTESTS_IP}"
-    - cd ${CI_PROJECT_DIR}
-    - mkdir -p ${APACHE_DOCUMENT_ROOT}
-    - cd ${APACHE_DOCUMENT_ROOT}
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/bootstrap.sh ]; then wp core download ${WORDPRESS_CLI_PARAMETERS} --allow-root; fi;
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/bootstrap.sh ]; then wp config create --dbhost=${MYSQL_IP} --dbname=wptest --dbuser=mysql --dbpass=mysql --allow-root; fi;
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/bootstrap.sh ]; then wp config set WP_DEBUG true --raw --type=constant --allow-root; fi;
-    - cd ${CI_PROJECT_DIR}
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/bootstrap.sh ]; then chmod a+x ./tests/codeception/bootstrap.sh; fi;
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/bootstrap.sh ]; then . ./tests/codeception/bootstrap.sh; fi;
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/wpdesk.yml ]; then composer prepare-wordpress-for-codeception; fi;
-    - if [ -f ${CI_PROJECT_DIR}/tests/codeception/wpdesk.yml ]; then composer prepare-local-codeception-tests; fi;
-    - if [ -d "${APACHE_DOCUMENT_ROOT}/wp-content/plugins/$CI_PROJECT_NAME" ]; then rm -r ${APACHE_DOCUMENT_ROOT}/wp-content/plugins/$CI_PROJECT_NAME; fi
-    - cp -r ${CI_PROJECT_DIR}/release/* ${APACHE_DOCUMENT_ROOT}/wp-content/plugins/
-    - mkdir -p ${CI_PROJECT_DIR}/tests/codeception/tests/_output
-    - mkdir -p ${CI_PROJECT_DIR}/tests/codeception/tests/acceptance
-    - mkdir -p ${CI_PROJECT_DIR}/tests/codeception/tests/functional
-    - mkdir -p ${CI_PROJECT_DIR}/tests/codeception/tests/unit
-    - chmod -R a+w ${APACHE_DOCUMENT_ROOT}/wp-content/uploads
-    - touch ${APACHE_DOCUMENT_ROOT}/wp-content/debug.log
-    - chmod a+w ${APACHE_DOCUMENT_ROOT}/wp-content/debug.log
-    - echo "End before"
-    - cd ${CI_PROJECT_DIR}
-  script:
-    - vendor/bin/codecept run --steps --xml --html -f --verbose
-  after_script:
-    - !reference [.after-codeception, after_script]
-    - 'if [[ ${REPORTPORTAL_AUTHORIZATION} && ${REPORTPORTAL_PROJECT} ]]; then curl -X POST "http://195.201.225.204:8080/api/v1/${REPORTPORTAL_PROJECT}/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "${REPORTPORTAL_AUTHORIZATION}" -F "file=@tests/codeception/tests/_output/report.xml;type=text/xml;filename=${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-codeception.xml"; fi'
-
-codeception smoke test:
-  <<: *job-codeception-smoke-test
-  only:
-    refs:
-      - tags
-
-codeception smoke test recorded manual:
-  <<: *job-codeception-smoke-test
-  when: manual
-  allow_failure: true
-  script:
-    - cp vendor/wpdesk/wp-codeception/configuration/codeception-with-recorder.dist.yml codeception-with-recorder.dist.yml
-    - vendor/bin/codecept -c codeception-with-recorder.dist.yml run --steps --xml --html -d
-  after_script:
-    - rm -r ${APACHE_DOCUMENT_ROOT}
-    - 'if [[ ${REPORTPORTAL_AUTHORIZATION} && ${REPORTPORTAL_PROJECT} ]]; then curl -X POST "http://195.201.225.204:8080/api/v1/${REPORTPORTAL_PROJECT}/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "${REPORTPORTAL_AUTHORIZATION}" -F "file=@tests/codeception/tests/_output/report.xml;type=text/xml;filename=${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-codeception.xml"; fi'
-    - 'curl -X POST --data-urlencode "payload={\"text\": \"Smoke testy projektu <${CI_PROJECT_URL}|${CI_PROJECT_NAME}> zostaƂy wykonane. <${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/browse/tests/codeception/tests/_output/records.html|Zapis testu>\", }" https://hooks.slack.com/services/${SLACK_AUTH}'
-- 
GitLab