-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Add another way to run tests locally with a system under test i…
…n docker (#3369) * TASK: Add another way to run tests locally with a system under test in docker * TASK: Also sym link inside TestDistribution to mounted Neos.TestNodeTypes package * Task: Make `make e2e-start-system-under-test` run on linux 64 * TASK: Fix stuff --------- Co-authored-by: Robert Baruck <robert.baruck@sandstorm.de> Co-authored-by: mhsdesign <85400359+mhsdesign@users.noreply.github.com>
- Loading branch information
1 parent
d301f14
commit 0a73f4f
Showing
5 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Tests/IntegrationTests/docker-compose.neos-dev-instance.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: "3.4" | ||
services: | ||
|
||
php: | ||
image: thecodingmachine/php:8.0-v4-cli-node16 | ||
command: tail -f /dev/null | ||
ports: | ||
- 8081:8081 | ||
volumes: | ||
- composer_cache:/home/circleci/.composer/cache | ||
# add Neos Ui root as cached read-only volume that will be later symlinked into TestDistribution/Packages/ | ||
- ../../.:/usr/src/neos-ui:cached,ro | ||
environment: | ||
# Enable GD | ||
PHP_EXTENSION_GD: 1 | ||
COMPOSER_CACHE_DIR: /home/circleci/.composer/cache | ||
|
||
db: | ||
image: mysql:8 | ||
environment: | ||
MYSQL_DATABASE: neos | ||
MYSQL_ROOT_PASSWORD: not_a_real_password | ||
|
||
volumes: | ||
composer_cache: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
function dc() { | ||
# use the docker composer plugin | ||
docker compose -f ./Tests/IntegrationTests/docker-compose.neos-dev-instance.yaml $@ | ||
} | ||
|
||
echo "#############################################################################" | ||
echo "# Start docker environment... #" | ||
echo "#############################################################################" | ||
dc down | ||
dc up -d | ||
dc exec -T php bash <<-'BASH' | ||
rm -rf /usr/src/app/* | ||
BASH | ||
docker cp "$(pwd)"/Tests/IntegrationTests/. "$(dc ps -q php)":/usr/src/app | ||
sleep 2 | ||
|
||
echo "" | ||
echo "#############################################################################" | ||
echo "# Install dependencies... #" | ||
echo "#############################################################################" | ||
dc exec -T php bash <<-'BASH' | ||
cd /usr/src/app | ||
sudo chown -R docker:docker . | ||
sudo chown -R docker:docker /home/circleci/ | ||
cd TestDistribution | ||
composer install | ||
BASH | ||
|
||
echo "#############################################################################" | ||
echo "# Initialize Neos... #" | ||
echo "#############################################################################" | ||
dc exec -T php bash <<-'BASH' | ||
cd TestDistribution | ||
sed -i 's/host: 127.0.0.1/host: db/g' Configuration/Settings.yaml | ||
./flow flow:cache:flush | ||
./flow flow:cache:warmup | ||
./flow doctrine:migrate | ||
./flow user:create --username=admin --password=password --first-name=John --last-name=Doe --roles=Administrator || true | ||
BASH | ||
|
||
echo "" | ||
echo "#############################################################################" | ||
echo "# Start Flow Server... #" | ||
echo "#############################################################################" | ||
dc exec -T php bash <<-'BASH' | ||
cd TestDistribution | ||
./flow server:run --port 8081 --host 0.0.0.0 & | ||
BASH | ||
|
||
dc exec -T php bash <<-BASH | ||
mkdir -p ./TestDistribution/DistributionPackages | ||
rm -rf ./TestDistribution/DistributionPackages/Neos.TestSite | ||
ln -s "../../Fixtures/1Dimension/SitePackage" ./TestDistribution/DistributionPackages/Neos.TestSite | ||
# TODO: optimize this | ||
cd TestDistribution | ||
composer reinstall neos/test-site | ||
./flow flow:cache:flush --force | ||
./flow flow:cache:warmup | ||
./flow configuration:show --path Neos.ContentRepository.contentDimensions | ||
if ./flow site:list | grep -q 'Node name'; then | ||
./flow site:prune '*' | ||
fi | ||
./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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters