File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed
packages/compass-smoke-tests/src Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { SUPPORTED_TESTS } from './tests/types';
66import { type SmokeTestsContext } from './context' ;
77import { SUPPORTED_PACKAGES } from './packages' ;
88import { testTimeToFirstQuery } from './tests/time-to-first-query' ;
9+ import { testReadOnly } from './tests/read-only' ;
910import { testAutoUpdateFrom } from './tests/auto-update-from' ;
1011import { testAutoUpdateTo } from './tests/auto-update-to' ;
1112
@@ -123,6 +124,8 @@ async function run() {
123124
124125 if ( testName === 'time-to-first-query' ) {
125126 await testTimeToFirstQuery ( context ) ;
127+ } else if ( testName === 'read-only' ) {
128+ await testReadOnly ( context ) ;
126129 } else if ( testName === 'auto-update-from' ) {
127130 await testAutoUpdateFrom ( context ) ;
128131 } else if ( testName === 'auto-update-to' ) {
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs' ;
2+ import { type SmokeTestsContext } from '../context' ;
3+ import { execute } from '../execute' ;
4+ import { getInstaller } from '../installers' ;
5+ import { createSandbox } from '../directories' ;
6+ import { getTestSubject } from '../test-subject' ;
7+
8+ export async function testReadOnly ( context : SmokeTestsContext ) {
9+ const sandboxPath = createSandbox ( ) ;
10+ const { kind, appName, filepath } = await getTestSubject ( {
11+ ...context ,
12+ sandboxPath,
13+ } ) ;
14+
15+ try {
16+ const install = getInstaller ( kind ) ;
17+
18+ const { appPath, uninstall } = install ( {
19+ appName,
20+ filepath,
21+ destinationPath : sandboxPath ,
22+ } ) ;
23+
24+ try {
25+ execute (
26+ 'npm' ,
27+ [
28+ 'run' ,
29+ '--unsafe-perm' ,
30+ 'test-packaged' ,
31+ '--workspace' ,
32+ 'compass-e2e-tests' ,
33+ '--' ,
34+ '--test-filter=read-only' ,
35+ ] ,
36+ {
37+ // We need to use a shell to get environment variables setup correctly
38+ shell : true ,
39+ env : {
40+ ...process . env ,
41+ COMPASS_APP_NAME : appName ,
42+ COMPASS_APP_PATH : appPath ,
43+ } ,
44+ }
45+ ) ;
46+ } finally {
47+ await uninstall ( ) ;
48+ }
49+ } finally {
50+ if ( context . skipCleanup ) {
51+ console . log ( `Skipped cleaning up sandbox: ${ sandboxPath } ` ) ;
52+ } else {
53+ console . log ( `Cleaning up sandbox: ${ sandboxPath } ` ) ;
54+ fs . rmSync ( sandboxPath , { recursive : true } ) ;
55+ }
56+ }
57+ }
Original file line number Diff line number Diff line change 11export const SUPPORTED_TESTS = [
22 'time-to-first-query' ,
3+ 'read-only' ,
34 'auto-update-from' ,
45 'auto-update-to' ,
56] as const ;
You can’t perform that action at this time.
0 commit comments