-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow running tests in a docker-compose env & fix failing tests (#1192)
- Loading branch information
Max Kuznetsov
authored
Mar 21, 2024
1 parent
35735d5
commit d332876
Showing
10 changed files
with
190 additions
and
90 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# every push to a branch: run tests | ||
name: Run tests | ||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
jobs: | ||
run_tests: | ||
name: Run Nakama tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run tests | ||
run: docker-compose -f ./docker-compose-tests.yml up --build --abort-on-container-exit | ||
|
||
- name: Cleanup | ||
if: always() | ||
run: docker-compose -f ./docker-compose-tests.yml down -v |
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
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,67 @@ | ||
version: "3.9" | ||
services: | ||
db: | ||
container_name: db | ||
image: postgres:15 | ||
command: -c 'max_connections=1000' | ||
environment: | ||
- POSTGRES_DB=nakama | ||
- POSTGRES_PASSWORD=localdb | ||
expose: | ||
- "5432" | ||
healthcheck: | ||
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "nakama"] | ||
start_period: 10s | ||
interval: 10s | ||
timeout: 10s | ||
retries: 10 | ||
|
||
nakama: | ||
build: | ||
context: . | ||
dockerfile: ./build/Dockerfile.local | ||
image: nakama-tests | ||
entrypoint: | ||
- "/bin/sh" | ||
- "-ecx" | ||
- > | ||
/nakama/nakama migrate up --database.address postgres:localdb@db:5432/nakama && | ||
exec /nakama/nakama --logger.level DEBUG --name nakama --database.address postgres:localdb@db:5432/nakama --session.token_expiry_sec 7200 --socket.port 7350 --console.port 7351 | ||
restart: always | ||
links: | ||
- "db:db" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
healthcheck: | ||
test: ["CMD", "/nakama/nakama", "healthcheck"] | ||
timeout: 10s | ||
retries: 10 | ||
start_period: 5s | ||
interval: 5s | ||
|
||
test: | ||
image: "golang:1.21" | ||
command: /bin/sh -c "mkdir -p /nakama/internal/gopher-lua/_lua5.1-tests/libs/P1; go test -v -race ./..." | ||
|
||
working_dir: "/nakama" | ||
environment: | ||
- "GODEBUG=netdns=cgo" | ||
- TEST_DB_URL=postgresql://postgres:localdb@db:5432/nakama?sslmode=disable | ||
volumes: | ||
- "./:/nakama" | ||
- "lua:/nakama/internal/gopher-lua/_lua5.1-tests/libs" | ||
links: | ||
- "db:db" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
nakama: | ||
condition: service_healthy | ||
|
||
volumes: | ||
lua: | ||
|
||
networks: | ||
default: | ||
driver: bridge |
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
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
Oops, something went wrong.