chocolatey-community / chocolatey-test-environment

A testing setup related to how the Chocolatey Package Verifier runs testing. Used for manual testing or prior to submission
Apache License 2.0
117 stars 187 forks source link

The following WinRM command responded with a non-zero exit status #52

Closed shaun-rutherford closed 4 years ago

shaun-rutherford commented 4 years ago

Hey Guys,

I'm unsure why when testing choco packages that exit in a 3010 I get the following error:

The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

powershell -ExecutionPolicy Bypass -OutputFormat Text -file "c:\tmp\vagrant-shell.ps1"

Stdout from the command:

Error message: https://gist.github.com/shaun-rutherford/083400876d203e59a48f45e08f162efe

Vagrantfile: https://gist.github.com/shaun-rutherford/a5c6c3e70a383d79f644f707e2c7b6da

The package passes if I install it once, reload the box and install it again. This is not really Ideal though as the install process takes ~15 mins each time.

I've tried doing a reload in advance but that doesn't work either.

Any assistance would really be appreciated.

pauby commented 4 years ago

This is standard behaviour. Chocolatey will exit with error code 3010 when the system requires a reboot. It can result in a package not being installed properly (as Windows can't install certain 'things' as the reboot is required to allow it to do so - this is Windows thing and not a Chocolatey one).

This is why when you install the package again after the reboot it all works.

shaun-rutherford commented 4 years ago

Hi @pauby thanks for getting back to me.

I understand that an exit of 3010 is pretty normal, does this mean when using the chocolatey-test-environment solution it's common practice to have to run the test twice to get it to pass?

If that's the case I suggest adding a note about this in the documentation, I spent a good number of hours trying to figure out what I was doing wrong for the test to fail on the first run every time.

It also makes me beg the question what is this line for? $validExitCodes = @(0, 1605, 1614, 1641, 3010, 1116)

I had assumed the validExitCodes variable was to tell the test if it exists with the following that it's okay, instead it appears to only pass on exit 0.

pauby commented 4 years ago

I understand that an exit of 3010 is pretty normal, does this mean when using the chocolatey-test-environment solution it's common practice to have to run the test twice to get it to pass?

It's common practice when using any environment to have to reboot when software that has been installed requires one. This isn't restricted to the chocolatey-test-environment.

If you go and install softwareA that requires a reboot to complete, but don't reboot, and then try and install softwareB that requires softwareA to be installed, it's going to fail whether you do it with Chocolatey or manually.

It also makes me beg the question what is this line for? $validExitCodes = @(0, 1605, 1614, 1641, 3010, 1116)

It tells Chocolatey that should the software / installer run from Install-ChocolateyInstallPackage return any of those exit codes, then Chocolatey should still consider the package installation a success. See Install-ChocolateyInstallPackage.

shaun-rutherford commented 4 years ago

@pauby Thanks very much for your help and explanation, much appreciated :)