test: add performance test in bugserver

This commit is contained in:
Rui-Sun 2023-08-24 16:54:53 +08:00 committed by Weixing Zhang
parent f77d9b41b1
commit b87816a340

View File

@ -209,6 +209,28 @@ async function triggerPhotoTest({ scmVersion, scmVersionStatus }: { scmVersion:
return res;
}
async function triggerPerformanceTest({
scmVersion,
scmVersionStatus
}: {
scmVersion: string;
scmVersionStatus: string;
}) {
const params = {
triggerType: 'performance-test',
scmVersion: scmVersion,
scmVersionStatus: scmVersionStatus,
commitId: process.env.GITHUB_SHA ?? '',
commitUrl: process.env.GITHUB_REF ?? '',
commitBranchName: process.env.GITHUB_HEAD_REF ?? '',
commitCreateUser: process.env.GITHUB_ACTOR ?? '',
commitDescription: ''
};
const res = await fetch<TriggerPhotoTestData>(API_URL, 'POST', () => getFormData(params));
return res;
}
async function getPhotoResult({ scmVersion, bundleId }: { scmVersion: string; bundleId: string }) {
const params = {
triggerType: 'photo-result',
@ -289,6 +311,9 @@ async function trigger() {
`[trigger], test result status: ${photoTestStatus}, totalCount: ${totalCount}, successCount: ${successCount}`
);
// trigger performance test
await triggerPerformanceTest({ scmVersion, scmVersionStatus });
if (photoTestStatus !== 'ok') {
throw new Error(`photo test status: ${photoTestStatus}`);
}