- 
                Notifications
    
You must be signed in to change notification settings  - 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
base: main
Are you sure you want to change the base?
Conversation
      
        
              This comment was marked as resolved.
        
        
      
    
  This comment was marked as resolved.
      
        
              This comment was marked as resolved.
        
        
      
    
  This comment was marked as resolved.
          
 Depending on what you are debugging that may be expected or not. If you are debugging the extension code running in the tests, there should be source maps which let you step through the typescript. But if you're debugging VSCode itself, unfortunately thats what we have without a lot more setup.  | 
    
…b.com/dotnet/vscode-csharp into dev/rigibson/integration-test-restore
| 
           @dibarbet pointed out the integration test may be failing because the waiter needs to be explicitly enabled in this context. The test does pass locally, but, maybe lack of the env var was causing a problem in CI. We will find out. It looks like it would also be an option to add a command line argument to LanguageServer and call   | 
    
| 
           This is the problem This probably means an SDK update is needed.  | 
    
| 
           @davidwengier just curious, have you seen this particular failure in razor integration tests before? If you have no clue that's OK, just looking for shortcuts in the investigation.. All that "failed to connect to the bus" stuff looks particularly suspicious to me  | 
    
          
 this is relatively normal and generally not indicative of the failure cause. most of the times I'd recommend looking at the actual c#/razor logs in the attached artifacts. the vscode process output is only occasionally useful  | 
    
          
 I'm continuing to see this as well as quite a few failing integration tests on re-run. Maybe we really are getting a Free Reproducer Of The Issue for our trouble. I won't be able to investigate in detail today, but, hopefully tomorrow.  | 
    
| 
           I haven't seen that error before today, but the same thing has just been reported on another Razor VS Code issue: microsoft/vscode-dotnettools#2229 I am planning to investigate that today, as this could be a cohosting issue unrelated to file-based programs (we do various crimes with generated document trees) though the fact that the exception originates from the CLaSP queue, and your test isn't modifying a Razor document, it seems relatively unlikely. EDIT: I just re-read where you tagged me, and to be clear, in this comment I'm talking about the "Syntax tree doesn't belong to the underlying 'Compilation'." exception, not the failing Razor tests you linked to. Sorry, too early for proper comprehension :)  | 
    
…ation-test-restore
| 
               | 
          ||
| const doRunSuite = process.env.RoslynSkipTestFileBasedPrograms !== 'true'; | ||
| console.log(`process.env.RoslynSkipTestFileBasedPrograms: ${process.env.RoslynSkipTestFileBasedPrograms}`); | ||
| const doRunSuite = process.env['ROSLYN_SKIP_TEST_FILE_BASED_PROGRAMS'] !== 'true'; | 
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.
System and user-defined variables (except secret variables) also get injected as environment variables for your platform. When variables convert into environment variables, variable names become uppercase, and periods turn into underscores. For example, the variable name any.variable becomes the variable name $ANY_VARIABLE.
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.
          
Maybe the remaining failing legs are using too old of an SDK? They may need to also have the env var added.  | 
    
| 
           @JoeRobich @dibarbet This is ready for review  | 
    
| 
               | 
          ||
| 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}`); | 
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.
consider extracting all this to a helper function similar to
| export const describeIfCSharp = describeIf(!usingDevKit()); | 
| let exports: CSharpExtensionExports; | ||
| 
               | 
          ||
| beforeAll(async () => { | ||
| process.env.RoslynWaiterEnabled = 'true'; | 
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.
Thinking it would be reasonable to set this for all Roslyn integration test runs, even if we don't use it yet.
e.g. 
| process.env.RUNNING_INTEGRATION_TESTS = 'true'; | 
I can look at that in a followup though myself.
| }); | ||
| 
               | 
          ||
| test('Inserting package directive triggers a restore', async () => { | ||
| await sleep(1); | 
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.
needed?
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.
This was taken from here:
vscode-csharp/test/lsptoolshost/integrationTests/onAutoInsert.integration.test.ts
Line 39 in b9eb6a9
| await sleep(1); | 
I didn't see a clear sign that it is needed, though, so I'll try deleting it here
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.
Oh I added it 😆 I suspect it was in there as I was debugging and I just forgot to remove it.
| displayName: Test Windows | ||
| dependsOn: [] | ||
| variables: | ||
| ROSLYN_SKIP_TEST_FILE_BASED_PROGRAMS: 'true' | 
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.
I assume we can enable the tests for windows/mac when we upgrade them to running on .NET 10?
| @@ -0,0 +1,4 @@ | |||
| 
               | 
          |||
| using Newton; | |||
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.
Instead of having this be in the file by default, should we insert it during the test? That way we can re-use the same base test file if we need to for other tests?

Depends on changes in dotnet/roslyn#79669