Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion modules/BOSH.Agent/BOSH.Agent.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,44 @@ Describe "BOSH.Account" {


Describe "Copy-Agent" {
BeforeAll {
$fixtureDir = (New-TempDir)
$agentDir = (Join-Path $fixtureDir "agent")
New-Item -Path $agentDir -ItemType Directory -Force
New-Item -Path (Join-Path -Path $agentDir -ChildPath "bosh-agent.exe" ) -ItemType File
New-Item -Path (Join-Path -Path $agentDir -ChildPath "service_wrapper.exe" ) -ItemType File
New-Item -Path (Join-Path -Path $agentDir -ChildPath "service_wrapper.xml" ) -ItemType File
$agentDepsDir = (Join-Path $agentDir "deps")
New-Item -Path $agentDepsDir -ItemType Directory -Force
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "bosh-blobstore-dav.exe" ) -ItemType File
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "bosh-blobstore-gcs.exe" ) -ItemType File
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "bosh-blobstore-s3.exe" ) -ItemType File
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "job-service-wrapper.exe" ) -ItemType File
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "pipe.exe" ) -ItemType File

$agentZipPath = (Join-Path $fixtureDir "bosh-agent.zip")
$compress = @{
Path = (Join-Path -Path $agentDir -ChildPath "*")
CompressionLevel = "Fastest"
DestinationPath = $agentZipPath
}
Compress-Archive @compress
}

BeforeEach {
$installDir = (New-TempDir)
$boshDir = (Join-Path $installDir "bosh")
$vcapDir = (Join-Path $installDir (Join-Path "var" (Join-Path "vcap" "bosh")))
$agentZipPath = (Join-Path $PSScriptRoot (Join-Path "fixtures" "bosh-agent.zip"))
}

AfterEach {
Remove-Item -Recurse -Force $installDir
}

AfterAll {
Remove-Item -Recurse -Force $fixtureDir
}

Context "when installDir is not provided" {
It "throws" {
{ Copy-Agent -agentZipPath $agentZipPath } | Should -Throw "Provide a directory to install the BOSH agent"
Expand Down Expand Up @@ -64,6 +91,7 @@ Describe "BOSH.Account" {
Test-Path (Join-Path $depsDir "bosh-blobstore-dav.exe") | Should -Be $True
Test-Path (Join-Path $depsDir "bosh-blobstore-s3.exe") | Should -Be $True
Test-Path (Join-Path $depsDir "bosh-blobstore-gcs.exe") | Should -Be $True
Test-Path (Join-Path $depsDir "tar.exe") | Should -Be $True
}
}

Expand Down
2 changes: 2 additions & 0 deletions modules/BOSH.Agent/BOSH.Agent.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function Copy-Agent
Open-Zip $agentZipPath $boshDir
Move-Item (Join-Path $boshDir (Join-Path "deps" "*")) $depsDir
Remove-Item -Path (Join-Path $boshDir "deps") -Force

New-Item -Path (Join-Path $depsDir "tar.exe") -ItemType SymbolicLink -V "C:\Windows\system32\tar.exe"
}


Expand Down
Binary file removed modules/BOSH.Agent/fixtures/bosh-agent.zip
Binary file not shown.
14 changes: 14 additions & 0 deletions modules/BOSH.CFCell/BOSH.CFCell.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ Describe "BOSH.CFCell" {

Should -Invoke -ModuleName BOSH.CFCell -CommandName Uninstall-WindowsFeature
}

Describe "tar.exe for Windows Diego Cells" {
BeforeEach {
$installDir = (New-TempDir)
$depsDir = (Join-Path -Path $installDir -ChildPath "var" -AdditionalChildPath ("vcap", "bosh", "bin") )
}

It "symlinks tar to \var\vcap\bosh\bin for backwards compatibility" {
{ Install-CFFeatures -IaaS "ignored" } | Should -Not -Throw

Test-Path (Join-Path $depsDir "tar.exe") | Should -Be $True
}

}
}

Describe "Remove-DockerPackage" {
Expand Down
5 changes: 5 additions & 0 deletions modules/BOSH.CFCell/BOSH.CFCell.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ function Install-CFFeatures
Write-Log "Setting WinRM startup type to automatic"
Get-Service | Where-Object { $_.Name -eq "WinRM" } | Set-Service -StartupType Automatic

Write-Log "Creating symlink to system tar.exe"
$link = "C:\var\vcap\bosh\bin\tar.exe"
$target = "C:\Windows\system32\tar.exe"
New-Item -Path $link -ItemType SymbolicLink -V $target

if ($ForceReboot -eq $true)
{
Restart-Computer
Expand Down
Loading