Skip to content

Commit

Permalink
(maint) Add ability to skip tests when not running in VM
Browse files Browse the repository at this point in the history
This commit updates the vagrant image and Invoke-Tests to handle
scenarios where tests has been added that should not run outside of
one of the virtual machines that we have available.
  • Loading branch information
AdmiringWorm committed Sep 22, 2022
1 parent 5119f58 commit 8d0e7ed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Invoke-Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ try {
Verbosity = 'Minimal'
}
Filter = @{
ExcludeTag = 'Background', 'Licensed', 'CCM', 'WIP', 'NonAdmin'
ExcludeTag = @(
'Background'
'Licensed'
'CCM'
'WIP'
'NonAdmin'
if (-not $env:VM_RUNNING -and -not $env:TEST_KITCHEN) {
'VMOnly'
}
)
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Vagrant.configure("2") do |config|
Write-Host "Build complete. Executing tests."
# $env:TEST_KITCHEN = 1
$env:VM_RUNNING = 1
./Invoke-Tests.ps1
SHELL
end
6 changes: 3 additions & 3 deletions tests/chocolatey-tests/choco-upgrade.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand {
}
}

Context "Upgrading packages while remembering arguments with only one package using arguments" {
Context "Upgrading packages while remembering arguments with only one package using arguments" -Tag Internal {
BeforeAll {
Restore-ChocolateyInstallSnapshot

Expand Down Expand Up @@ -156,7 +156,7 @@ Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand {

# We exclude this test when running CCM, as it will install and remove
# the firefox package which is used through other tests that will be affected.
Context "Upgrading packages while remembering arguments with multiple packages using arguments" -Tag CCMExcluded {
Context "Upgrading packages while remembering arguments with multiple packages using arguments" -Tag CCMExcluded, Internal, VMOnly {
BeforeAll {
Restore-ChocolateyInstallSnapshot

Expand Down Expand Up @@ -195,7 +195,7 @@ Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand {
}

It 'Outputs firefox using eu as language locale' {
$Output.Lines | Should -Contain "Using locale 'eu'..."
$Output.Lines | Should -Contain "Using locale 'eu'..." -Because $Output.String
}

It 'Outputs running firefox script with correct arguments' {
Expand Down

0 comments on commit 8d0e7ed

Please sign in to comment.