Skip to content

Commit a0af8d4

Browse files
committed
fix(ci): "Running as root without --no-sandbox"
1 parent 4e40536 commit a0af8d4

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.github/workflows/node.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
macos:
14-
name: macOS nodejs
14+
name: test macOS
1515
runs-on: macos-latest
1616
strategy:
1717
matrix:
@@ -53,7 +53,7 @@ jobs:
5353
flags: codewhisperer
5454

5555
windows:
56-
name: Windows nodejs
56+
name: test Windows
5757
runs-on: windows-2019
5858
strategy:
5959
matrix:
@@ -83,7 +83,7 @@ jobs:
8383
flags: windows-unittests
8484

8585
lint:
86-
name: Ubuntu nodejs Lint
86+
name: Lint
8787
runs-on: ubuntu-latest
8888
strategy:
8989
matrix:

scripts/test/launchTestUtilities.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ export async function setupVSCodeTestInstance(): Promise<string> {
4949

5050
export async function invokeVSCodeCli(vsCodeExecutablePath: string, args: string[]): Promise<string> {
5151
const [cli, ...cliArgs] = resolveCliArgsFromVSCodeExecutablePath(vsCodeExecutablePath)
52-
const cmdArgs = [...cliArgs, ...args]
52+
// Disable sandbox to avoid: "Running as root without --no-sandbox is not supported".
53+
// https://github.com/aws/aws-toolkit-vscode/issues/3550
54+
// https://crbug.com/638180
55+
const cmdArgs = ['--no-sandbox', ...cliArgs, ...args]
5356

5457
// Workaround: set --user-data-dir to avoid this error in CI:
5558
// "You are trying to start Visual Studio Code as a super user …"
@@ -130,6 +133,11 @@ async function setupVSCode(): Promise<string> {
130133
}
131134

132135
export async function runToolkitTests(suiteName: string, relativeEntryPoint: string) {
136+
// Disable sandbox to avoid: "Running as root without --no-sandbox is not supported".
137+
// https://github.com/aws/aws-toolkit-vscode/issues/3550
138+
// https://crbug.com/638180
139+
const noSandboxArgs = ['--no-sandbox', '--disable-gpu-sandbox']
140+
133141
try {
134142
console.log(`Running ${suiteName} test suite...`)
135143
const vsCodeExecutablePath = await setupVSCode()
@@ -154,7 +162,7 @@ export async function runToolkitTests(suiteName: string, relativeEntryPoint: str
154162
vscodeExecutablePath: vsCodeExecutablePath,
155163
extensionDevelopmentPath: cwd,
156164
extensionTestsPath: testEntrypoint,
157-
launchArgs: [...disableExtensions, workspacePath, disableWorkspaceTrust],
165+
launchArgs: [...noSandboxArgs, ...disableExtensions, workspacePath, disableWorkspaceTrust],
158166
extensionTestsEnv: {
159167
['DEVELOPMENT_PATH']: cwd,
160168
['AWS_TOOLKIT_AUTOMATION']: suiteName,

scripts/test/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { setupVSCodeTestInstance } from './launchTestUtilities'
2121
extensionDevelopmentPath: rootDir,
2222
extensionTestsPath: testEntrypoint,
2323
// For verbose VSCode logs, add "--verbose --log debug". c2165cf48e62c
24-
launchArgs: [testWorkspace],
24+
launchArgs: ['--no-sandbox', '--disable-gpu-sandbox', testWorkspace],
2525
extensionTestsEnv: {
2626
['DEVELOPMENT_PATH']: rootDir,
2727
['AWS_TOOLKIT_AUTOMATION']: 'unit',

0 commit comments

Comments
 (0)