Repository navigation
Expand file tree
/
Copy pathtest-selection.ts
More file actions
82 lines (80 loc) · 2.71 KB
/
Copy pathtest-selection.ts
File metadata and controls
82 lines (80 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
export const smokeFiles = ['tests/app-lifecycle.test.ts']
export const nginxReloadRaceFiles = ['tests/nginx-reload-keepalive.test.ts']
export const coreFiles = [
'tests/authentication.test.ts',
'tests/app-configuration.test.ts',
'tests/projects.test.ts',
'tests/deployments.test.ts',
'tests/source-upload-and-logs.test.ts',
'tests/app-routing.test.ts',
'tests/app-nginx.test.ts',
'tests/advanced-app-settings.test.ts',
'tests/system-info.test.ts',
'tests/one-click.test.ts',
]
export const destructiveFiles = [
'tests/system-defaults.test.ts',
'tests/persistent-storage.test.ts',
'tests/custom-ports.test.ts',
'tests/themes.test.ts',
'tests/backup.test.ts',
'tests/disk-cleanup.test.ts',
'tests/system-nginx.test.ts',
'tests/one-click-repositories.test.ts',
'tests/registries.test.ts',
'tests/goaccess.test.ts',
'tests/netdata.test.ts',
'tests/git-webhooks.test.ts',
]
export const sslAndRegistryFiles = [
'tests/specialized/ssl-and-registry.test.ts',
]
export const multiNodeFiles = ['tests/specialized/multi-node.test.ts']
export const proAnd2faFiles = ['tests/specialized/pro-and-2fa.test.ts']
export const upgradeFiles = ['tests/specialized/upgrade.test.ts']
export function requireEphemeral(environment = process.env): void {
if (environment.CAPROVER_E2E_ENVIRONMENT !== 'ephemeral') {
throw new Error(
'Destructive tests require CAPROVER_E2E_ENVIRONMENT=ephemeral'
)
}
}
export function selectTests(mode: string, environment = process.env): string[] {
switch (mode) {
case 'unit':
return ['tests/unit/**/*.test.ts']
case 'smoke':
return smokeFiles
case 'core':
return coreFiles
case 'nginx-reload-race':
return nginxReloadRaceFiles
case 'destructive':
requireEphemeral(environment)
return destructiveFiles
case 'ssl-and-registry':
requireEphemeral(environment)
return sslAndRegistryFiles
case 'multi-node':
requireEphemeral(environment)
return multiNodeFiles
case 'pro-and-2fa':
requireEphemeral(environment)
return proAnd2faFiles
case 'upgrade':
requireEphemeral(environment)
return upgradeFiles
case 'test':
case 'all':
return [
'tests/unit/**/*.test.ts',
...smokeFiles,
...coreFiles,
...(environment.CAPROVER_E2E_ENVIRONMENT === 'ephemeral'
? destructiveFiles
: []),
]
default:
throw new Error(`Unknown test mode: ${mode}`)
}
}