-
Couldn't load subscription status.
- Fork 727
Add integration test for restore of file-based programs #8470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
RikkiGibson
wants to merge
39
commits into
main
Choose a base branch
from
dev/rigibson/integration-test-restore
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+156
−26
Draft
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
bd19287
add test resource
RikkiGibson 1305e21
WIP: Integration test for file-based programs restore scenario
RikkiGibson e0dea11
Merge remote-tracking branch 'origin/main' into dev/rigibson/integrat…
RikkiGibson 3458d52
add D.B.props
RikkiGibson d4b5997
cleanup
RikkiGibson f9be157
inspect details of notifications from server
RikkiGibson 5fd1d9c
use 'waitForAllAsyncOperationsAsync'
RikkiGibson 45e4d45
simplify
RikkiGibson fa315bc
fix lint errors
RikkiGibson 02e435c
Merge remote-tracking branch 'origin/main' into dev/rigibson/integrat…
RikkiGibson 0ef2931
WIP: bump roslyn version
RikkiGibson 5a32bb2
rekick CI after adding package to feeds
RikkiGibson ad92e62
fix lint errors
RikkiGibson 2239641
Merge branch 'dev/rigibson/integration-test-restore' of https://githu…
RikkiGibson e4e236a
Merge remote-tracking branch 'origin/main' into dev/rigibson/integrat…
RikkiGibson 2fd2774
enable waiter in restore tests via env var
RikkiGibson 3beee8e
I installed eslint finally
RikkiGibson 3054919
condition test on new enough sdk
RikkiGibson 94a2175
includePreviewVersions
RikkiGibson 386f63e
use exact version
RikkiGibson f31eeaa
remove unnecessary(?) flag
RikkiGibson 4fb723a
dot dot dot...
RikkiGibson b9637ba
update package name
RikkiGibson 2493d9d
Explicitly get ubuntu noble numbat containers
RikkiGibson eb24923
Merge remote-tracking branch 'upstream/main' into dev/rigibson/integr…
RikkiGibson 3c5d899
fix yml. fix skip test variable.
RikkiGibson 77781dc
fix container name
RikkiGibson cc3d74f
fix for I bet the last time
RikkiGibson 9d742a3
Move env var in pipeline
RikkiGibson 7cf3de2
try to inspect what is happening in CI
RikkiGibson 78c2213
try different name
RikkiGibson 3e60d31
use template parameter
RikkiGibson c2f35aa
fix name
RikkiGibson dd46cce
try to deal with azdo env var weirdness
RikkiGibson b78119a
finish rename
RikkiGibson 0baa5ab
rename test file
RikkiGibson 885011d
More skips
RikkiGibson a56489b
Merge branch 'main' into dev/rigibson/integration-test-restore
RikkiGibson c030821
Merge branch 'main' into dev/rigibson/integration-test-restore
RikkiGibson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
test/lsptoolshost/integrationTests/fileBasedPrograms.integration.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import * as vscode from 'vscode'; | ||
| import * as path from 'path'; | ||
| import testAssetWorkspace from './testAssets/testAssetWorkspace'; | ||
| import { | ||
| activateCSharpExtension, | ||
| closeAllEditorsAsync, | ||
| getCompletionsAsync, | ||
| openFileInWorkspaceAsync, | ||
| revertActiveFile, | ||
| sleep, | ||
| waitForAllAsyncOperationsAsync, | ||
| waitForExpectedResult, | ||
| } from './integrationHelpers'; | ||
| import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; | ||
| import { CSharpExtensionExports } from '../../../src/csharpExtensionExports'; | ||
|
|
||
| const doRunSuite = process.env['ROSLYN_SKIP_TEST_FILE_BASED_PROGRAMS'] !== 'true'; | ||
| console.log(`process.env.ROSLYN_SKIP_TEST_FILE_BASED_PROGRAMS: ${process.env.ROSLYN_SKIP_TEST_FILE_BASED_PROGRAMS}`); | ||
| console.log(`doRunSuite: ${doRunSuite}`); | ||
| (doRunSuite ? describe : describe.skip)(`File-based Programs Tests`, () => { | ||
| let exports: CSharpExtensionExports; | ||
|
|
||
| beforeAll(async () => { | ||
| process.env.RoslynWaiterEnabled = 'true'; | ||
| exports = await activateCSharpExtension(); | ||
| }); | ||
|
|
||
| beforeEach(async () => { | ||
| await openFileInWorkspaceAsync(path.join('src', 'scripts', 'app1.cs')); | ||
| }); | ||
|
|
||
| afterEach(async () => { | ||
| await revertActiveFile(); | ||
| await closeAllEditorsAsync(); | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| await testAssetWorkspace.cleanupWorkspace(); | ||
| }); | ||
|
|
||
| test('Inserting package directive triggers a restore', async () => { | ||
| await sleep(1); | ||
| await vscode.window.activeTextEditor!.edit((editBuilder) => { | ||
| editBuilder.insert(new vscode.Position(0, 0), '#:package [email protected]'); | ||
| }); | ||
| await vscode.window.activeTextEditor!.document.save(); | ||
| await waitForAllAsyncOperationsAsync(exports); | ||
|
|
||
| const position = new vscode.Position(1, 'using Newton'.length); | ||
| await waitForExpectedResult<vscode.CompletionList>( | ||
| async () => getCompletionsAsync(position, undefined, 10), | ||
| 10 * 1000, | ||
| 100, | ||
| (completionItems) => expect(completionItems.items.map((item) => item.label)).toContain('Newtonsoft') | ||
| ); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../lsptoolshost/integrationTests/testAssets/slnWithCsproj/src/scripts/Directory.Build.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
| <!-- Integration tests need to cleanup artifacts between runs. Putting the artifacts under 'testAssets' will ensure this happens when assets are overwritten after test run. --> | ||
| <ArtifactsPath>$(MSBuildThisFileDirectory)</ArtifactsPath> | ||
| </PropertyGroup> | ||
| </Project> |
4 changes: 4 additions & 0 deletions
4
test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/src/scripts/app1.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| using Newton; | ||
|
|
||
| Console.WriteLine("Hello World!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import * as lsp from 'vscode-languageserver-protocol'; | ||
|
|
||
| export interface WaitForAsyncOperationsParams { | ||
| /** | ||
| * The operations to wait for. | ||
| */ | ||
| operations: string[]; | ||
| } | ||
|
|
||
| export interface WaitForAsyncOperationsResponse {} // eslint-disable-line @typescript-eslint/no-empty-object-type | ||
|
|
||
| export namespace WaitForAsyncOperationsRequest { | ||
| export const method = 'workspace/waitForAsyncOperations'; | ||
| export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer; | ||
| export const type = new lsp.RequestType<WaitForAsyncOperationsParams, WaitForAsyncOperationsResponse, void>(method); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#environment-variables
Linux env vars are case sensitive, so, the
env.lookup is case sensitive. Since we were not using an uppercase name to access the env var, we weren't seeing it in the test.Figuring this out took an unreasonable amount of time.