Skip to content

Commit

Permalink
Change to ./test/test.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Nov 9, 2023
1 parent b85b3e0 commit 140b641
Show file tree
Hide file tree
Showing 14 changed files with 333 additions and 282 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ jobs:
if: matrix.testenv == 'dev'
run: |
set -eux
docker compose -f docker-compose.yml -f docker-compose.build.yml up --build -d
docker compose -f docker-compose.test.yml --profile dev up
./test/test.sh dev 1 1
- name: Integration test 1 (prod)
- name: Integration test (prod)
if: matrix.testenv == 'prod'
run: |
set -eux
(
cd docs/full-bf2-stack-example
sed -i '$!N;s@ports:\n - 53:53.*@@;P;D' docker-compose.yml # Remove coredns ports because it conflicts with system-resolved on the host
docker compose -f docker-compose.yml -f docker-compose.build.yml up --build -d
)
docker compose -f docker-compose.test.yml --profile prod up
docker compose -f docker-compose.test.yml --profile dns up
# Don't publish coredns ports to prevent conflict with system-resolved on github CI
# sed -i '$!N;s@ports:\n - 53:53.*@@;P;D' docker-compose.yml
# Make coredns listen on localhost only to prevent conflict with system-resolved on github CI
sed -i 's/- 53:53/- 127.0.0.1:53:53/' docs/full-bf2-stack-example/docker-compose.yml
./test/test.sh prod 1 1
build:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
{
"label": "Test (dev)",
"type": "shell",
"command": "docker-compose -f docker-compose.test.yml --profile dev up --force-recreate",
"command": "./test/test.sh dev 1",
"group": "build"
},
{
"label": "Test (prod)",
"type": "shell",
"command": "docker-compose -f docker-compose.test.yml --profile prod up --force-recreate",
"command": "./test/test.sh prod 1 1",
"group": "build"
},
{
"label": "Test (dns)",
"type": "shell",
"command": "docker-compose -f docker-compose.test.yml --profile dns up --force-recreate",
"command": "./test/test.sh dns",
"group": "build"
},
]
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,23 @@ docker exec -it $( docker-compose ps -q asp ) ls -al /src/ASP/system/logs
# asp - List snapshots
docker exec -it $( docker-compose ps -q asp ) ls -alR /src/ASP/system/snapshots/

# Test routes
docker-compose -f docker-compose.test.yml --profile dev up
# Test
./test/test.sh dev 1

# Test production builds
(cd docs/full-bf2-stack-example && docker-compose -f docker-compose.yml -f docker-compose.build.yml up --build)
docker-compose -f docker-compose.test.yml --profile prod up
docker-compose -f docker-compose.test.yml --profile dns up
./test/test.sh prod 1 1

# Dump the DB
docker exec $( docker-compose ps | grep db | awk '{print $1}' ) mysqldump -uroot -pascent bf2stats | gzip > bf2stats.sql.gz
docker exec $( docker-compose ps -q db ) mysqldump -uroot -pascent bf2stats | gzip > bf2stats.sql.gz

# Restore the DB
zcat bf2stats.sql.gz | docker exec -i $( docker-compose ps | grep db | awk '{print $1}' ) mysql -uroot -pascent bf2stats
zcat bf2stats.sql.gz | docker exec -i $( docker-compose ps -q db ) mysql -uroot -pascent bf2stats

# Stop
docker-compose down

# Cleanup
docker-compose down
docker-compose down --remove-orphans
docker volume rm asp_backups-volume
docker volume rm asp_cache-volume
docker volume rm asp_config-volume
Expand Down
261 changes: 0 additions & 261 deletions docker-compose.test.yml

This file was deleted.

5 changes: 5 additions & 0 deletions docs/full-bf2-stack-example/docker-compose.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ services:
- type=local,src=/tmp/.buildx-cache-asp
# cache_to:
# - type=local,dest=/tmp/.buildx-cache-asp,mode=max

db:
volumes:
- ../../src/ASP/system/sql/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro # Seed the DB the first time
- ../../src/ASP/system/sql/data.sql:/docker-entrypoint-initdb.d/02-data.sql:ro # Seed the DB the first time
1 change: 1 addition & 0 deletions test/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=asp
35 changes: 35 additions & 0 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '2.2'
services:
test-container-networking:
image: alpine:latest
volumes:
- ./:/test:ro
networks:
- gamespy-network
- bf2-network
stop_signal: SIGKILL
working_dir: /test
entrypoint:
- /bin/sh
command:
- -c
- |
sleep infinity
test-host-networking:
image: alpine:latest
volumes:
- ./:/test:ro
network_mode: host
stop_signal: SIGKILL
working_dir: /test
entrypoint:
- /bin/sh
command:
- -c
- |
sleep infinity
networks:
bf2-network:
gamespy-network:
Loading

0 comments on commit 140b641

Please sign in to comment.