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

TASK: Add another way to run tests locally with a system under test in docker #3369

Merged
merged 4 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
TASK: Fix stuff
  • Loading branch information
JamesAlias committed Feb 20, 2023
commit d93c3cffd3ba86417110920812e6fe4b70e7bf62
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ test-e2e:
test-e2e-docker:
@bash Tests/IntegrationTests/e2e-docker.sh $(or $(browser),chrome)

e2e-start-system-under-test:
bash Tests/IntegrationTests/start-system-under-test-docker.sh
start-neos-dev-instance:
bash Tests/IntegrationTests/start-neos-dev-instance.sh

## Executes make lint-js and make lint-editorconfig.
lint: lint-js lint-editorconfig
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ For executing the end to end tests on a Mac with catalina or higher you need to

#### Local Development with e2e-tests & docker
To speed up the e2e-test workflow/feedback loop you can start the system under test in a docker setup and run the tests against that:
* `make e2e-start-system-under-test` (starts a docker setup with the system under test)
* `make start-neos-dev-instance` (starts a docker setup with the system under test)
* The neos dev instance is available at `localhost:8081`
* To enter the container run `docker compose -f Tests/IntegrationTests/docker-compose.neos-dev-instance.yaml exec php bash`
* `yarn run testcafe <browser> <testFile> <optional flags>`
* for example, this runs all tests in chrome:
`yarn run testcafe chrome Tests/IntegrationTests/Fixtures`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
COMPOSER_CACHE_DIR: /home/circleci/.composer/cache

db:
image: ${DB_IMAGE}
image: mysql:8
environment:
MYSQL_DATABASE: neos
MYSQL_ROOT_PASSWORD: not_a_real_password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,9 @@

set -e

ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
export DB_IMAGE=arm64v8/mysql:8
elif [ "$ARCH" = "x86_64" ]; then
export DB_IMAGE=mysql:8
else
echo "Unknown architecture"
exit 1
fi

function dc() {
if [ -n "$(docker compose version)" ]; then
# use the docker composer plugin
docker compose -f ./Tests/IntegrationTests/docker-compose.system-under-test.yaml $@
else
# legacy docker compose standalone
docker-compose -f ./Tests/IntegrationTests/docker-compose.system-under-test.yaml $@
fi
# use the docker composer plugin
docker compose -f ./Tests/IntegrationTests/docker-compose.neos-dev-instance.yaml $@
}

echo "#############################################################################"
Expand All @@ -45,23 +30,6 @@ dc exec -T php bash <<-'BASH'
composer install
BASH

echo ""
echo "#############################################################################"
echo "# Create sym links to mounted Docker volumes... #"
echo "#############################################################################"
echo ""
dc exec -T php bash <<-'BASH'
# replace installed Neos Ui with local dev via sym link to mounted volume
# WHY: We want changes of dev to appear in system under test without rebuilding the whole system
rm -rf Packages/Application/Neos.Neos.Ui
ln -s /usr/src/neos-ui/ /usr/src/app/TestDistribution/Packages/Application/Neos.Neos.Ui

# enable changes of the Neos.TestNodeTypes outside of the container to appear in the container via sym link to mounted volume
rm -rf /usr/src/app/TestDistribution/DistributionPackages/Neos.TestNodeTypes
rm -rf /usr/src/app/TestDistribution/Packages/Application/Neos.TestNodeTypes
ln -s /usr/src/neos-ui/Tests/IntegrationTests/SharedNodeTypesPackage/ /usr/src/app/TestDistribution/Packages/Application/Neos.TestNodeTypes
BASH

echo "#############################################################################"
echo "# Initialize Neos... #"
echo "#############################################################################"
Expand Down Expand Up @@ -103,3 +71,19 @@ dc exec -T php bash <<-BASH
./flow site:import --package-key=Neos.TestSite
./flow resource:publish
BASH

echo ""
echo "#############################################################################"
echo "# Create sym links to mounted Docker volumes... #"
echo "#############################################################################"
echo ""
dc exec -T php bash <<-'BASH'
# replace installed Neos Ui with local dev via sym link to mounted volume
# WHY: We want changes of dev to appear in system under test without rebuilding the whole system
rm -rf /usr/src/app/TestDistribution/Packages/Application/Neos.Neos.Ui
ln -s /usr/src/neos-ui /usr/src/app/TestDistribution/Packages/Application/Neos.Neos.Ui

# enable changes of the Neos.TestNodeTypes outside of the container to appear in the container via sym link to mounted volume
rm -rf /usr/src/app/TestDistribution/Packages/Application/Neos.TestNodeTypes
ln -s /usr/src/neos-ui/Tests/IntegrationTests/SharedNodeTypesPackage/ /usr/src/app/TestDistribution/Packages/Application/Neos.TestNodeTypes
BASH