microsoft / microsoft/vscode-test

Fails to run if cached: Error IPC handle is longer than 103 chars.

Open
#232 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
316
Forks
73
Avg merge
1d 6h
Merged PRs (30d)
3

Description

Running the test locally on a non-cached instance of VS Code works the first time, but fails if it has been cached.

Note:
It looks like runTests is making a "copy" of the download in $(PWD)/.vscode-test even though I have already downloaded it to a shorter path.

Sample code:

        // try and have a short path to prevent socket errors.
        const cachePath = path.join(extensionDevelopmentPath, cacheDirName);
        const vscodeExecutablePath = await downloadAndUnzipVSCode({ cachePath });
        const options = { vscodeExecutablePath, extensionDevelopmentPath, extensionTestsPath, launchArgs };

        // Note: `.vscode-test` does NOT exist
        console.error('dir before: %o', await fs.readdir('.'));
        await runTests(options);
        // Note: `.vscode-test` does NOW exist
        console.error('dir after: %o', await fs.readdir('.'));

In my case:

  • extensionDevelopmentPath is /Users/jason/projects/vscode-spell-checker
  • Integration tests are run from: /Users/jason/projects/vscode-spell-checker/packages/_integrationTests
Error Log:
Found existing install in /Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0. Skipping download
WARNING: IPC handle "/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock" is longer than 103 chars, try a shorter --user-data-dir
[main 2023-09-08T09:20:14.043Z] Could not delete obsolete instance handle Error: ENOENT: no such file or directory, unlink '/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock'
    at unlinkSync (node:original-fs:1829:3)
    at Ee.e (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:3946)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1222
    at async Ee.a (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1108) {
  errno: -2,
  syscall: 'unlink',
  code: 'ENOENT',
  path: '/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock'
}
[main 2023-09-08T09:20:14.045Z] Error: ENOENT: no such file or directory, unlink '/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock'
    at unlinkSync (node:original-fs:1829:3)
    at Ee.e (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:3946)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1222
    at async Ee.a (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1108)
Exit code:   1
Failed
Failed to run tests
About VS Code
Version: 1.82.0 (Universal)
Commit: 8b617bd08fd9e3fc94d14adb8d358b56e3f72314
Date: 2023-09-06T22:09:41.364Z
Electron: 25.8.0
ElectronBuildId: 23503258
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin x64 22.6.0

Workaround

The workaround is to delete $(PWD)/.vscode-test before running the tests:

        // Delete `.vscode-test` to prevent socket issues
        await fs.rm('.vscode-test', { recursive: true, force: true });

        const cachePath = path.join(extensionDevelopmentPath, cacheDirName);
        const vscodeExecutablePath = await downloadAndUnzipVSCode({ cachePath });
        const options = { vscodeExecutablePath, extensionDevelopmentPath, extensionTestsPath, launchArgs };
        await runTests(options);

Related Issues

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the runTests and downloadAndUnzipVSCode entry points, focusing on how the supplied cachePath is used after a cached download. Reproduce the issue with the sample paths and cached VS Code installation. Done means cached runs avoid creating the longer .vscode-test path and complete without the IPC handle error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.