This commit is contained in:
aozhiwei 2022-04-30 11:46:02 +08:00
parent 5f5c0addac
commit 996de7f2f1
2 changed files with 41 additions and 19 deletions

View File

@ -1,16 +1,16 @@
const TestCase = require('./testcase'); const TestCase = require('./testcase');
const urls = { const urls = {
'login': 'https://login-z2-test.cebg.games', 'login': 'https://login-z4-test.cebg.games',
'cloud': 'https://cloud-z2-test.cebg.games', 'cloud': 'https://cloud-z4-test.cebg.games',
'service': 'https://service-z2-test.cebg.games', 'service': 'https://service-z4-test.cebg.games',
'gamelog': 'https://gamelog-z2-test.cebg.games', 'gamelog': 'https://gamelog-z4-test.cebg.games',
'mail': 'https://gamemail-z2-test.cebg.games', 'mail': 'https://gamemail-z4-test.cebg.games',
'stat': 'https://stat-z2-test.cebg.games', 'stat': 'https://stat-z4-test.cebg.games',
'game2006api': 'https://game2006api-z2-test.cebg.games', 'game2006api': 'https://game2006api-z4-test.cebg.games',
'relation': 'ws://relation-z2-test.cebg.games/friend/websocket', 'relation': 'ws://relation-z4-test.cebg.games/friend/websocket',
'game2006': 'ws://game2006-z2-test.cebg.games', 'game2006': 'ws://game2006-z4-test.cebg.games',
'game2006-n1': 'ws://game2006-z2-test-n1.cebg.games', 'game2006-n1': 'ws://game2006-z4-test-n1.cebg.games',
}; };
async function start() { async function start() {

View File

@ -1,6 +1,10 @@
const axios = require('axios').default; const axios = require('axios').default;
const ClientNet = require('./clientnet'); const ClientNet = require('./clientnet');
function getTickCount() {
return Math.floor((new Date()).getTime() / 1);
}
function httpGet(url, params) { function httpGet(url, params) {
return new Promise((resolve) => { return new Promise((resolve) => {
const ret = { const ret = {
@ -56,6 +60,7 @@ class TestCase {
} }
async step1() { async step1() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['login'] + '/webapp/index.php', this.urls['login'] + '/webapp/index.php',
{ {
@ -67,57 +72,68 @@ class TestCase {
'openid': '123456' 'openid': '123456'
}); });
this.loginData = response; 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() { async step2() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['cloud'] + '/webapp/index.php', this.urls['cloud'] + '/webapp/index.php',
{ {
'c': 'Ops', 'c': 'Ops',
'a': 'selfChecking', '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() { async step3() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['service'] + '/webapp/index.php', this.urls['service'] + '/webapp/index.php',
{ {
'c': 'Ops', 'c': 'Ops',
'a': 'selfChecking', '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() { async step4() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['gamelog'] + '/webapp/index.php', this.urls['gamelog'] + '/webapp/index.php',
{ {
'c': 'Ops', 'c': 'Ops',
'a': 'selfChecking', '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() { async step5() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['mail'] + '/webapp/index.php', this.urls['mail'] + '/webapp/index.php',
{ {
'c': 'Ops', 'c': 'Ops',
'a': 'selfChecking', '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() { async step6() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['game2006api'] + '/webapp/index.php', this.urls['game2006api'] + '/webapp/index.php',
{ {
'c': 'Ops', 'c': 'Ops',
'a': 'selfChecking', '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() { async step7() {
@ -151,6 +167,7 @@ class TestCase {
} }
async step9() { async step9() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['game2006'].replace('wss://', 'https://'). this.urls['game2006'].replace('wss://', 'https://').
replace('ws://', 'https://') + replace('ws://', 'https://') +
@ -159,10 +176,12 @@ class TestCase {
'c': 'Ops', 'c': 'Ops',
'a': 'getNodeId', '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() { async step10() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['game2006-n1'].replace('wss://', 'https://'). this.urls['game2006-n1'].replace('wss://', 'https://').
replace('ws://', 'https://') + replace('ws://', 'https://') +
@ -171,17 +190,20 @@ class TestCase {
'c': 'Ops', 'c': 'Ops',
'a': 'getNodeId', '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() { async step11() {
const startTick = getTickCount();
const {err, response} = await httpGet( const {err, response} = await httpGet(
this.urls['stat'] + '/webapp/index.php', this.urls['stat'] + '/webapp/index.php',
{ {
'c': 'Ops', 'c': 'Ops',
'a': 'selfChecking', 'a': 'selfChecking',
}); });
console.log('stat selfChecking@Ops', String(err), response); const endTick = getTickCount();
console.log('stat selfChecking@Ops', endTick - startTick, String(err), response);
} }
} }