fix(admin): 生产环境隐藏并禁用自动化测试
侧栏与路由按服务端 NODE_ENV 控制;可通过 ALLOW_SMOKE_TESTS=true 临时开启。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { appForbidden } from '../../../shared/common/app-error';
|
||||
import { PrismaService } from '../../../shared/prisma/prisma.service';
|
||||
import { AgentsService } from '../../agent/agents.service';
|
||||
import { BetsService } from '../../betting/bets.service';
|
||||
@@ -30,6 +31,17 @@ export class SmokeTestService {
|
||||
private agents: AgentsService,
|
||||
) {}
|
||||
|
||||
isAllowed(): boolean {
|
||||
if (process.env.ALLOW_SMOKE_TESTS === 'true') return true;
|
||||
return process.env.NODE_ENV !== 'production';
|
||||
}
|
||||
|
||||
assertAllowed() {
|
||||
if (!this.isAllowed()) {
|
||||
throw appForbidden('SMOKE_TESTS_FORBIDDEN');
|
||||
}
|
||||
}
|
||||
|
||||
listSuites(): SmokeTestSuiteInfo[] {
|
||||
const counts = new Map<string, number>();
|
||||
for (const c of SMOKE_TEST_CASES) {
|
||||
|
||||
Reference in New Issue
Block a user