Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests #41

Merged
merged 16 commits into from
Dec 12, 2023
5 changes: 2 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ jobs:
strategy:
matrix:
ddev_version: [stable, HEAD]
# ddev_version: [stable, edge, HEAD, PR]
fail-fast: false

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -85,7 +84,7 @@ jobs:
if: github.event.inputs.debug_enabled == 'true'

- name: tests
run: ./tests/bats/bin/bats ./tests/
run: ./tests/bats/bin/bats ./tests

# keepalive-workflow adds a dummy commit if there's no other action here, keeps
# GitHub from turning off tests after 60 days
Expand Down
21 changes: 0 additions & 21 deletions config.dkan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,6 @@ use_dns_when_possible: true
composer_version: "2"
nodejs_version: "16"

webimage_extra_packages:
- chromium
- chromium-driver
- g++
- libgtk2.0-0
- libgtk-3-0
- libgbm-dev
- libnotify-dev
- libgconf-2-4
- libnss3
- libxss1
- libasound2
- libxtst6
- make
- python2
- python3-pip
- unzip
- wget
- xauth
- xvfb

web_environment:
- COMPOSER_MEMORY_LIMIT=-1
- PHP_MEM_LIMIT=256M
Expand Down
11 changes: 6 additions & 5 deletions tests/dkan-init.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ setup() {
load 'test_helper/bats-assert/load'

export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export TESTDIR=~/tmp/test-addon-template
export TESTDIR=~/tmp/test-addon-init
mkdir -p $TESTDIR
export PROJNAME=test-addon-template
export PROJNAME=test-addon-init
export DDEV_NON_INTERACTIVE=true
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true
cd "${TESTDIR}"
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true
rm -rf *
ddev config --project-name=${PROJNAME}
ddev get ${DIR}
ddev restart >/dev/null
Expand Down Expand Up @@ -61,8 +62,8 @@ teardown() {

touch composer.json

run ddev dkan-init --project-version 10.1.x-dev
assert_output --partial "Using project version: 10.1.x-dev"
run ddev dkan-init --project-version 10.0.x-dev
assert_output --partial "Using project version: 10.0.x-dev"
assert_output --partial "Found composer.json"
assert_failure

Expand Down
8 changes: 5 additions & 3 deletions tests/frontend-local-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ setup() {
load 'test_helper/bats-assert/load'

export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export PROJNAME=test-dkan-ddev-addon
export PROJNAME=test-dkan-frontend-local
export TESTDIR=~/tmp/$PROJNAME
mkdir -p $TESTDIR
export DDEV_NON_INTERACTIVE=true
ddev delete -Oy ${PROJNAME} || true
rm -rf $TESTDIR
mkdir -p $TESTDIR
cd "${TESTDIR}"
pwd

ddev config --project-name=${PROJNAME}
ddev get ${DIR}
ddev dkan-init --force
mv .ddev/misc/docker-compose.cypress.yaml .ddev/docker-compose.cypress.yml
ddev restart
ddev dkan-init --force
ddev dkan-site-install
ddev dkan-frontend-install
ddev dkan-frontend-build
Expand Down
8 changes: 5 additions & 3 deletions tests/frontend.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ setup() {
load 'test_helper/bats-assert/load'

export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export PROJNAME=test-dkan-ddev-addon
export PROJNAME=test-dkan-frontend
export TESTDIR=~/tmp/$PROJNAME
mkdir -p $TESTDIR
export DDEV_NON_INTERACTIVE=true
ddev delete -Oy ${PROJNAME} || true
rm -rf $TESTDIR
mkdir -p $TESTDIR
cd "${TESTDIR}"
pwd

ddev config --project-name=${PROJNAME}
ddev get ${DIR}
ddev dkan-init --force
mv .ddev/misc/docker-compose.cypress.yaml .ddev/docker-compose.cypress.yml
ddev restart
ddev dkan-init --force
ddev dkan-site-install
}

Expand Down
9 changes: 5 additions & 4 deletions tests/phpunit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ setup() {
load 'test_helper/bats-assert/load'

export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export PROJNAME=test-dkan-ddev-addon
export PROJNAME=test-dkan-phpunit
export TESTDIR=~/tmp/$PROJNAME
mkdir -p $TESTDIR
export DDEV_NON_INTERACTIVE=true
ddev delete -Oy ${PROJNAME} || true
rm -rf $TESTDIR
mkdir -p $TESTDIR
cd "${TESTDIR}"
pwd

ddev config --project-name=${PROJNAME}
ddev get ${DIR}
ddev restart

ddev dkan-init --force
# TODO: Change this after https://www.drupal.org/project/moderated_content_bulk_publish/issues/3301389
ddev composer require drupal/pathauto:^1.10
Expand Down
23 changes: 11 additions & 12 deletions tests/project-test-phpunit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'

export SUT_DIR=$(pwd)
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export PROJNAME=test-dkan-ddev-addon
SUT_DIR=$(pwd)
export SUT_DIR
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export DIR
export PROJNAME=test-dkan-phpunit
export TESTDIR=~/tmp/$PROJNAME
mkdir -p $TESTDIR
export DDEV_NON_INTERACTIVE=true
ddev delete -Oy ${PROJNAME} || true
rm -rf $TESTDIR
mkdir -p $TESTDIR
cd "${TESTDIR}"

ddev config --project-name=${PROJNAME}
ddev get ${DIR}
ddev dkan-init --force
mv .ddev/misc/docker-compose.cypress.yaml .ddev/docker-compose.cypress.yml
ddev restart
ddev dkan-site-install
}

teardown() {
Expand All @@ -34,15 +41,7 @@ teardown() {
assert_output --partial "PHPUnit config not found"
assert_failure

# Add config, but no executable.
mkdir -p docroot/modules/custom
cp .ddev/misc/phpunit.xml docroot/modules/custom
run ddev project-test-phpunit
assert_output --partial "Unable to find PHPUnit executable"
assert_failure

# Can perform test run, for a group that doesn't exist.
ddev dkan-init --force
mkdir -p docroot/modules/custom
cp .ddev/misc/phpunit.xml docroot/modules/custom
run ddev project-test-phpunit --group this-group-should-not-exist
Expand Down