diff --git a/components/hab/tests/test_install_script.ps1 b/components/hab/tests/test_install_script.ps1 index 47a84c730c..1cafd0e7bc 100644 --- a/components/hab/tests/test_install_script.ps1 +++ b/components/hab/tests/test_install_script.ps1 @@ -1,31 +1,49 @@ Describe "Install habitat using install.ps1" { It "can install the latest version of Habitat" { components/hab/install.ps1 - $LASTEXITCODE | Should -Be 0 - (Get-Command hab).Path | Should -Be "C:\ProgramData\Habitat\hab.exe" + if ($LASTEXITCODE -ne 0) { + throw "Installation failed with exit code $LASTEXITCODE" + } + + $path = (Get-Command hab).Path + if ($path -ne "C:\ProgramData\Habitat\hab.exe") { + throw "Expected Habitat path 'C:\ProgramData\Habitat\hab.exe' but got '$path'" + } } It "can install a specific version of Habitat" { components/hab/install.ps1 -v 0.90.6 - $LASTEXITCODE | Should -Be 0 + if ($LASTEXITCODE -ne 0) { + throw "Installation failed with exit code $LASTEXITCODE" + } $result = hab --version - $result | Should -Match "hab 0.90.6/*" + if ($result -notmatch "hab 0\.90\.6/.*") { + throw "Expected version 'hab 0.90.6/*' but got '$result'" + } } It "can install a specific version of legacy Habitat package" { components/hab/install.ps1 -v 0.79.1 - $LASTEXITCODE | Should -Be 0 + if ($LASTEXITCODE -ne 0) { + throw "Installation failed with exit code $LASTEXITCODE" + } $result = hab --version - $result | Should -Match "hab 0.79.1/*" + if ($result -notmatch "hab 0\.79\.1/.*") { + throw "Expected version 'hab 0.79.1/*' but got '$result'" + } } It "ignores release when installing from packages.chef.io" { components/hab/install.ps1 -v "0.90.6/20191112141314" - $LASTEXITCODE | Should -Be 0 + if ($LASTEXITCODE -ne 0) { + throw "Installation failed with exit code $LASTEXITCODE" + } $result = hab --version - $result | Should -Match "hab 0.90.6/*" + if ($result -notmatch "hab 0\.90\.6/.*") { + throw "Expected version 'hab 0.90.6/*' but got '$result'" + } } }