Skip to content

[dev] Make the gRPC client init test more resilient on Windows #2059

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

Closed
3 tasks done
kittaakos opened this issue May 10, 2023 · 1 comment · Fixed by #2062
Closed
3 tasks done

[dev] Make the gRPC client init test more resilient on Windows #2059

kittaakos opened this issue May 10, 2023 · 1 comment · Fixed by #2062
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

Describe the problem

#2023 added integration tests to check whether the CLI daemon can recover from an inconsistent directories.data state during the core client initialization.

The tests do the followings:

  • start the CLI daemon,
  • initialize a valid state,
  • stop the CLI daemon,
  • corrupt the directories.data folder by deleting platform tools, primary package, and library indexes,
  • start the CLI daemon,
  • run init,
  • verify if the daemon is functional.

The tests tend to fail on Windows. As also noted in #2028, deleting the platform tools might fail because the OS is holding the process.

The tests must do the following to be more resilient:

  • initialize valid directories.data structure via the CLI using ./arduino-cli core update-index,
  • save the valid directories.data folder,
  • each test case should copy the correct folder and corrupt it.

To reproduce

Please review the issue description and check for flaky builds on the CI.

Example:

 1) core-client-provider
       should recover when the 'packages\builtin\tools\serial-discovery' folder is missing:
     Error: EPERM: operation not permitted, unlink 'c:\Users\RUNNER~1\AppData\Local\Temp\d-2023410-708-166j91u.ub7p\.testArduinoIDE\data\Arduino15\packages\builtin\tools\serial-discovery\1.4.0\serial-discovery.exe'
      at Object.unlinkSync (node:fs:1722:3)
      at fixWinEPERMSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:219:13)
      at rimrafSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:319:28)
      at D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:350:5
      at Array.forEach (<anonymous>)
      at rmkidsSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:349:26)
      at rmdirSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:342:7)
      at fixWinEPERMSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:217:5)
      at rimrafSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:319:28)
      at D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:350:5
      at Array.forEach (<anonymous>)
      at rmkidsSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:349:26)
      at rmdirSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:342:7)
      at fixWinEPERMSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:217:5)
      at rimrafSync (D:\a\arduino-ide\arduino-ide\node_modules\rimraf\rimraf.js:319:28)
      at Context.<anonymous> (lib\test\node\core-client-provider.slow-test.js:86:27)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

Expected behavior

The CI is not failing randomly.

Arduino IDE version

36e2092

Operating system

Windows

Operating system version

N/A

Additional context

When the CI is red due to failed tests, GH Actions will report a false positive defect with the certificates:

The job was canceled because "windows-2019_WINDOWS_SIGNING_CERTIFICATE_PFX_WINDOWS_SIGNING_CERTIFICATE_PASSWORD_pfx" failed.
Screen Shot 2023-05-10 at 10 02 01

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels May 10, 2023
@kittaakos kittaakos self-assigned this May 10, 2023
@kittaakos
Copy link
Contributor Author

We have to fix this ASAP, as the nightly builds are flaky.

kittaakos pushed a commit that referenced this issue May 11, 2023
It should make integration tests more resilient on the Windows CI.

From now on, tests are not starting a daemon to initialize the
`directories.data` folder for the test suites but rely on the raw
command. It is required to avoid spawning the discovery processes, which
cannot be terminated on Windows while the daemon is up and running.

Closes #2059

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos kittaakos added the conclusion: resolved Issue was resolved label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant