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

(#4) Adds Windows Sandbox to Test-Package #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JPRuskin
Copy link

@JPRuskin JPRuskin commented Apr 6, 2023

Description

This adds a really messy addition to the Test-Package function, which allows users to test package install/uninstall with Windows Sandbox rather than Vagrant or Local testing.

It is not in my regular style but attempts to match the existing function. I'm not fully successful in this.

Motivation / Context

There was a request to use Windows Sandbox, which is wonderfully performant, for package testing. This seemed like a great addition!

Fixes #4.

This adds a really messy addition to the Test-Package function, which allows users to test package install/uninstall with Windows Sandbox rather than Vagrant or Local testing. 

It is not in my regular style but attempts to match the existing function. I'm not fully successful in this.
@Thilas
Copy link

Thilas commented Jun 19, 2023

@JPRuskin, what you've done here looks pretty good. What do you mean by "I'm not fully successful in this"?

@JPRuskin
Copy link
Author

JPRuskin commented Jun 19, 2023

What do you mean by "I'm not fully successful in this"?

Ah, mostly just that my code-style doesn't fully match the rest of the module as it's currently written.

I'll say that the way you currently need to invoke sandbox doesn't help this!

Copy link

@Thilas Thilas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a classic review, here is a PR with a few changes I'd like to share regarding your work on Sandbox: JPRuskin#1

Copy-Item -Path $Nu -Destination $SandboxTempFolder

try {
& WindowsSandbox "$SandboxTempFolder\ChocoTestingSandbox.wsb"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check for an existing windowssandbox process. If there is already one, then this will fail and we'll be waiting for the timeout to hit needlessly.

image

I would recommend the check happen early before we've done a bunch of setup.

if ($Results.InstallExitCode -ne 0) { throw "choco install failed with $($Results.InstallExitCode)"}
}
if ($Uninstall) {
if ($Results.UninstallExitCode -ne 0) { throw "choco install failed with $($Results.UninstallExitCode)"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be choco uninstall failed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very true! I'll get that sorted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Test-Package option to use Windows Sandbox
4 participants