From 996de7f2f190fc12907f084d683f33316e1c5490 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 30 Apr 2022 11:46:02 +0800 Subject: [PATCH] 1 --- scripts/check_server/app.js | 20 ++++++++-------- scripts/check_server/testcase.js | 40 +++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/scripts/check_server/app.js b/scripts/check_server/app.js index b92d356..deb32d8 100644 --- a/scripts/check_server/app.js +++ b/scripts/check_server/app.js @@ -1,16 +1,16 @@ const TestCase = require('./testcase'); const urls = { - 'login': 'https://login-z2-test.cebg.games', - 'cloud': 'https://cloud-z2-test.cebg.games', - 'service': 'https://service-z2-test.cebg.games', - 'gamelog': 'https://gamelog-z2-test.cebg.games', - 'mail': 'https://gamemail-z2-test.cebg.games', - 'stat': 'https://stat-z2-test.cebg.games', - 'game2006api': 'https://game2006api-z2-test.cebg.games', - 'relation': 'ws://relation-z2-test.cebg.games/friend/websocket', - 'game2006': 'ws://game2006-z2-test.cebg.games', - 'game2006-n1': 'ws://game2006-z2-test-n1.cebg.games', + 'login': 'https://login-z4-test.cebg.games', + 'cloud': 'https://cloud-z4-test.cebg.games', + 'service': 'https://service-z4-test.cebg.games', + 'gamelog': 'https://gamelog-z4-test.cebg.games', + 'mail': 'https://gamemail-z4-test.cebg.games', + 'stat': 'https://stat-z4-test.cebg.games', + 'game2006api': 'https://game2006api-z4-test.cebg.games', + 'relation': 'ws://relation-z4-test.cebg.games/friend/websocket', + 'game2006': 'ws://game2006-z4-test.cebg.games', + 'game2006-n1': 'ws://game2006-z4-test-n1.cebg.games', }; async function start() { diff --git a/scripts/check_server/testcase.js b/scripts/check_server/testcase.js index b2658b5..ebf5bc1 100644 --- a/scripts/check_server/testcase.js +++ b/scripts/check_server/testcase.js @@ -1,6 +1,10 @@ const axios = require('axios').default; const ClientNet = require('./clientnet'); +function getTickCount() { + return Math.floor((new Date()).getTime() / 1); +} + function httpGet(url, params) { return new Promise((resolve) => { const ret = { @@ -56,6 +60,7 @@ class TestCase { } async step1() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['login'] + '/webapp/index.php', { @@ -67,57 +72,68 @@ class TestCase { 'openid': '123456' }); this.loginData = response; - console.log('login auth@Login', String(err), response); + const endTick = getTickCount(); + console.log('login auth@Login', endTick - startTick, String(err), response); } async step2() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['cloud'] + '/webapp/index.php', { 'c': 'Ops', 'a': 'selfChecking', }); - console.log('cloud selfChecking@Ops', String(err), response); + const endTick = getTickCount(); + console.log('cloud selfChecking@Ops', endTick - startTick, String(err), response); } async step3() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['service'] + '/webapp/index.php', { 'c': 'Ops', 'a': 'selfChecking', }); - console.log('service selfChecking@Ops', String(err), response); + const endTick = getTickCount(); + console.log('service selfChecking@Ops', endTick - startTick, String(err), response); } async step4() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['gamelog'] + '/webapp/index.php', { 'c': 'Ops', 'a': 'selfChecking', }); - console.log('gamelog selfChecking@Ops', String(err), response); + const endTick = getTickCount(); + console.log('gamelog selfChecking@Ops', endTick - startTick, String(err), response); } async step5() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['mail'] + '/webapp/index.php', { 'c': 'Ops', 'a': 'selfChecking', }); - console.log('mail selfChecking@Ops', String(err), response); + const endTick = getTickCount(); + console.log('mail selfChecking@Ops', endTick - startTick, String(err), response); } async step6() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['game2006api'] + '/webapp/index.php', { 'c': 'Ops', 'a': 'selfChecking', }); - console.log('game2006api selfChecking@Ops', String(err), response); + const endTick = getTickCount(); + console.log('game2006api selfChecking@Ops', endTick - startTick, String(err), response); } async step7() { @@ -151,6 +167,7 @@ class TestCase { } async step9() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['game2006'].replace('wss://', 'https://'). replace('ws://', 'https://') + @@ -159,10 +176,12 @@ class TestCase { 'c': 'Ops', 'a': 'getNodeId', }); - console.log('game2006 getNodeId@Ops', String(err), response); + const endTick = getTickCount(); + console.log('game2006 getNodeId@Ops', endTick - startTick, String(err), response); } async step10() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['game2006-n1'].replace('wss://', 'https://'). replace('ws://', 'https://') + @@ -171,17 +190,20 @@ class TestCase { 'c': 'Ops', 'a': 'getNodeId', }); - console.log('game2006-n1 getNodeId@Ops', String(err), response); + const endTick = getTickCount(); + console.log('game2006-n1 getNodeId@Ops', endTick - startTick, String(err), response); } async step11() { + const startTick = getTickCount(); const {err, response} = await httpGet( this.urls['stat'] + '/webapp/index.php', { 'c': 'Ops', 'a': 'selfChecking', }); - console.log('stat selfChecking@Ops', String(err), response); + const endTick = getTickCount(); + console.log('stat selfChecking@Ops', endTick - startTick, String(err), response); } }