Skip to content
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

Web: integration test failures in workspace events #102365

Closed
bpasero opened this issue Jul 13, 2020 · 9 comments
Closed

Web: integration test failures in workspace events #102365

bpasero opened this issue Jul 13, 2020 · 9 comments
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders integration-test-failure web Issues related to running VSCode in the web
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jul 13, 2020

Only failing in Web and only running out of sources it seems:

 2 failing
  1) vscode API - workspace events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument:
      AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: /ijnhhxi-NEW <-> /bombyiu
      + expected - actual
      -false
      +true
      at assertEqualPath (extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:284:10)
      at extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:302:30
      at extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:323:36
      at Array.forEach (<anonymous>)
      at Context.<anonymous> (extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:323:18)
      at processTicksAndRejections (internal/process/task_queues.js:89:5)
  2) vscode API - workspace events: onDidSaveTextDocument fires even for non dirty file when saved:
      AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: /eyglyouflp <-> /ytgwtrbtfq
      + expected - actual
      -false
      +true
      at assertEqualPath (extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:284:10)
      at extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:335:30
      at extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:344:32
      at Array.forEach (<anonymous>)
      at Context.<anonymous> (extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts:344:18)
      at processTicksAndRejections (internal/process/task_queues.js:89:5)
@bpasero bpasero added integration-test-failure web Issues related to running VSCode in the web labels Jul 13, 2020
@bpasero bpasero added this to the July 2020 milestone Jul 13, 2020
@jrieken
Copy link
Member

jrieken commented Jul 13, 2020

this._proxy.$acceptModelSaved(e.model.resource);

⬆️ that's where the onDidSaveTextDocument-event is driven from. So, either a problem with the web-logic or because of the setup. E.g auto-save in web vs manual save in desktop?

@bpasero
Copy link
Member Author

bpasero commented Jul 13, 2020

@jrieken oh yeah, auto save is on by default in web, good catch! could that be the reason?

@jrieken
Copy link
Member

jrieken commented Jul 13, 2020

idk - I would still expect a save event to be fired when calling save (as done here). Tho, it might be the wrong command 🤷. From the failure logs it seems that something gets saved but not what we are expecting...

@bpasero
Copy link
Member Author

bpasero commented Jul 13, 2020

@jrieken this seems to be an issue with how tests are setup. If I only run the workspace tests I see none failing, via suite.only:

A listener not cleaned up?

@jrieken
Copy link
Member

jrieken commented Jul 13, 2020

A listener not cleaned up?

Only in the web, unlikely. Maybe missing cleanup because of a failure... So, the second could be a false-alarm because the first failed?

@bpasero
Copy link
Member Author

bpasero commented Jul 14, 2020

This is indeed caused by auto save being enabled by default in web, changing this line fixes the test failure:

'default': platform.isWeb ? AutoSaveConfiguration.AFTER_DELAY : AutoSaveConfiguration.OFF,

So in theory, a test maybe leaves a model dirty, then continues to run other tests and then after 1s that previous model is being auto saved.

I see two options:

  • we simply disable auto save when tests run
  • the owner of these tests checks if possibly a model is not getting disposed at the end of the test and thus has a chance to get auto saved

@bpasero
Copy link
Member Author

bpasero commented Jul 14, 2020

It would be easier if somehow the name of the test could be part of the models that are being created so that we know from which test the save kicks in.

@jrieken
Copy link
Member

jrieken commented Jul 14, 2020

The weird thing is that the first failing tests already calls saveAll. So, either that's not working or another leaked listener modifies files based on those event. The -NEW suffix is a hint, there isn't so many tests using that but nothing obvious

@bpasero
Copy link
Member Author

bpasero commented Jul 14, 2020

I added a new command _workbench.revertAllDirty as a replacement for saveAll and added it to the two tests that rely on the onDidSaveTextDocument event.

Bottom line: saveAll only goes over the opened dirty editors and saves them, but does not save dirty working copies that do not have an associated editor (in this case we had dirty models from bulk edits in the background not being opened). I did not want to go as far as to change saveAll to work on hidden working copies so I found this the safer fix.

Charles-Gagnon pushed a commit to Charles-Gagnon/vscode that referenced this issue Jul 14, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders integration-test-failure web Issues related to running VSCode in the web
Projects
None yet
Development

No branches or pull requests

3 participants
@bpasero @jrieken and others