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 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() {

View File

@ -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);
}
}