From 0b8f33184249abd36f3ee946e1212e2cc9c91f6e Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Sun, 6 Sep 2020 18:19:40 +0800 Subject: [PATCH 1/2] add test_Game stress test --- .../res/goworld.ini | 0 .github/res/goworld_stress.ini | 85 +++++++++++++++++++ .github/workflows/test.yml | 2 +- .github/workflows/test_game.yml | 4 +- .github/workflows/test_game_stress.yml | 48 +++++++++++ 5 files changed, 136 insertions(+), 3 deletions(-) rename goworld_actions.ini => .github/res/goworld.ini (100%) create mode 100644 .github/res/goworld_stress.ini create mode 100644 .github/workflows/test_game_stress.yml diff --git a/goworld_actions.ini b/.github/res/goworld.ini similarity index 100% rename from goworld_actions.ini rename to .github/res/goworld.ini diff --git a/.github/res/goworld_stress.ini b/.github/res/goworld_stress.ini new file mode 100644 index 00000000..5c5e0df9 --- /dev/null +++ b/.github/res/goworld_stress.ini @@ -0,0 +1,85 @@ +[debug] +debug = 1 ; set to 0 in production + +[deployment] +desired_dispatchers=100 +desired_games=200 +desired_gates=400 + +[storage] +type=mongodb +url=mongodb://127.0.0.1:27017/ +db=goworld + +[kvdb] +type=mongodb +url=mongodb://127.0.0.1:27017/goworld +db=goworld +collection=__kv__ +;type=redis +;url=redis://127.0.0.1:6379 +;db=1 +;type=redis_cluster +;start_nodes_1=127.0.0.1:6379 +;start_nodes_2=127.0.0.2:6379 + +[dispatcher_common] +listen_addr=127.0.0.1:13000 +advertise_addr=127.0.0.1:13000 +http_addr=127.0.0.1:23000 +log_file=dispatcher.log +log_stderr=true +log_level=debug + +[dispatcher1] +listen_addr=127.0.0.1:13001 +advertise_addr=127.0.0.1:13001 +http_addr=127.0.0.1:23001 +[dispatcher2] +listen_addr=127.0.0.1:13002 +advertise_addr=127.0.0.1:13002 +http_addr=127.0.0.1:23002 + +[game_common] +boot_entity=Account +save_interval=600 +log_file=game.log +log_stderr=true +http_addr=127.0.0.1:25000 +log_level=debug +position_sync_interval_ms=100 ; position sync: server -> client +; gomaxprocs=0 + +[game1] +http_addr=25001 +; ban_boot_entity=false +[game2] +http_addr=25002 +;ban_boot_entity=false +;[game3] +;http_addr=25003 +;;ban_boot_entity=false + +[gate_common] +; gomaxprocs=0 +log_file=gate.log +log_stderr=true +http_addr=127.0.0.1:24000 +listen_addr=0.0.0.0:14000 +log_level=debug +compress_connection=1 +encrypt_connection=1 +rsa_key=rsa.key +rsa_certificate=rsa.crt +heartbeat_check_interval = 0 +position_sync_interval_ms=100 ; position sync: client -> server + +[gate1] +listen_addr=0.0.0.0:14001 +http_addr=127.0.0.1:24001 +[gate2] +listen_addr=0.0.0.0:14002 +http_addr=127.0.0.1:24002 +;[gate3] +;listen_addr=0.0.0.0:14003 +;http_addr=127.0.0.1:24003 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fc527a28..256587ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v2 - name: Test run: | - cp goworld_actions.ini goworld.ini + cp .github/goworld.ini goworld.ini bash covertest.sh - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 diff --git a/.github/workflows/test_game.yml b/.github/workflows/test_game.yml index 7313c456..e03c6459 100644 --- a/.github/workflows/test_game.yml +++ b/.github/workflows/test_game.yml @@ -16,7 +16,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go: [1.11, 1.14] + go: [1.14] os: ["ubuntu-18.04"] mongodb-version: [3.6] steps: @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v2 - name: Test Game run: | - cp goworld_actions.ini goworld.ini + cp .github/goworld.ini goworld.ini go get ./cmd/... goworld build examples/test_client goworld build examples/test_game diff --git a/.github/workflows/test_game_stress.yml b/.github/workflows/test_game_stress.yml new file mode 100644 index 00000000..4cac1676 --- /dev/null +++ b/.github/workflows/test_game_stress.yml @@ -0,0 +1,48 @@ +name: Test Game + +on: [ pull_request ] + +jobs: + cancel-previous-runs: + runs-on: ubuntu-18.04 + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "github.ref != 'refs/heads/master'" + + test_game: + name: Test Game (Go ${{ matrix.go }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + go: [1.14] + os: ["ubuntu-18.04"] + mongodb-version: [3.6] + steps: + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.3.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} + - uses: shogo82148/actions-setup-redis@v1 + with: + redis-version: '4.x' + - uses: actions/checkout@v2 + - name: Test Game + run: | + cp .github/goworld_stress.ini goworld.ini + go get ./cmd/... + goworld build examples/test_client + goworld build examples/test_game + goworld start examples/test_game + sleep 5 + examples/test_client/test_client -N 200 -strict -duration 300 + sleep 5 + goworld reload examples/test_game + sleep 5 + examples/test_client/test_client -N 200 -strict -duration 60 + sleep 1 + goworld stop examples/test_game From b02843246cc52f4ddb2e19ddd1b2b4ecff8c6757 Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Sun, 6 Sep 2020 18:22:30 +0800 Subject: [PATCH 2/2] fix --- .github/workflows/test.yml | 2 +- .github/workflows/test_game.yml | 2 +- .github/workflows/test_game_stress.yml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 256587ff..7b4ef0ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v2 - name: Test run: | - cp .github/goworld.ini goworld.ini + cp .github/res/goworld.ini goworld.ini bash covertest.sh - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 diff --git a/.github/workflows/test_game.yml b/.github/workflows/test_game.yml index e03c6459..5b7fbea7 100644 --- a/.github/workflows/test_game.yml +++ b/.github/workflows/test_game.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v2 - name: Test Game run: | - cp .github/goworld.ini goworld.ini + cp .github/res/goworld.ini goworld.ini go get ./cmd/... goworld build examples/test_client goworld build examples/test_game diff --git a/.github/workflows/test_game_stress.yml b/.github/workflows/test_game_stress.yml index 4cac1676..8f6d4c1d 100644 --- a/.github/workflows/test_game_stress.yml +++ b/.github/workflows/test_game_stress.yml @@ -1,4 +1,4 @@ -name: Test Game +name: Test Game (Stress) on: [ pull_request ] @@ -31,9 +31,9 @@ jobs: with: redis-version: '4.x' - uses: actions/checkout@v2 - - name: Test Game + - name: Test Game (Stress) run: | - cp .github/goworld_stress.ini goworld.ini + cp .github/res/goworld_stress.ini goworld.ini go get ./cmd/... goworld build examples/test_client goworld build examples/test_game