Skip to content

Commit a96180a

Browse files
committed
refactor: build agent-zip as part of test
* the contents were all zero byte files anyway. This way we at least see the zip contents in code
1 parent 130742d commit a96180a

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

modules/BOSH.Agent/BOSH.Agent.Tests.ps1

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,44 @@ Describe "BOSH.Account" {
2121

2222

2323
Describe "Copy-Agent" {
24+
BeforeAll {
25+
$fixtureDir = (New-TempDir)
26+
$agentDir = (Join-Path $fixtureDir "agent")
27+
New-Item -Path $agentDir -ItemType Directory -Force
28+
New-Item -Path (Join-Path -Path $agentDir -ChildPath "bosh-agent.exe" ) -ItemType File
29+
New-Item -Path (Join-Path -Path $agentDir -ChildPath "service_wrapper.exe" ) -ItemType File
30+
New-Item -Path (Join-Path -Path $agentDir -ChildPath "service_wrapper.xml" ) -ItemType File
31+
$agentDepsDir = (Join-Path $agentDir "deps")
32+
New-Item -Path $agentDepsDir -ItemType Directory -Force
33+
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "bosh-blobstore-dav.exe" ) -ItemType File
34+
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "bosh-blobstore-gcs.exe" ) -ItemType File
35+
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "bosh-blobstore-s3.exe" ) -ItemType File
36+
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "job-service-wrapper.exe" ) -ItemType File
37+
New-Item -Path (Join-Path -Path $agentDepsDir -ChildPath "pipe.exe" ) -ItemType File
38+
39+
$agentZipPath = (Join-Path $fixtureDir "bosh-agent.zip")
40+
$compress = @{
41+
Path = (Join-Path -Path $agentDir -ChildPath "*")
42+
CompressionLevel = "Fastest"
43+
DestinationPath = $agentZipPath
44+
}
45+
Compress-Archive @compress
46+
}
47+
2448
BeforeEach {
2549
$installDir = (New-TempDir)
2650
$boshDir = (Join-Path $installDir "bosh")
2751
$vcapDir = (Join-Path $installDir (Join-Path "var" (Join-Path "vcap" "bosh")))
28-
$agentZipPath = (Join-Path $PSScriptRoot (Join-Path "fixtures" "bosh-agent.zip"))
2952
}
3053

3154
AfterEach {
3255
Remove-Item -Recurse -Force $installDir
3356
}
3457

58+
AfterAll {
59+
Remove-Item -Recurse -Force $fixtureDir
60+
}
61+
3562
Context "when installDir is not provided" {
3663
It "throws" {
3764
{ Copy-Agent -agentZipPath $agentZipPath } | Should -Throw "Provide a directory to install the BOSH agent"
-1.64 KB
Binary file not shown.

modules/BOSH.CFCell/BOSH.CFCell.Tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ Describe "BOSH.CFCell" {
109109

110110
Should -Invoke -ModuleName BOSH.CFCell -CommandName Uninstall-WindowsFeature
111111
}
112+
113+
Describe "tar.exe for Windows Diego Cells" {
114+
BeforeEach {
115+
$installDir = (New-TempDir)
116+
$depsDir = (Join-Path -Path $installDir -ChildPath "var" -AdditionalChildPath ("vcap", "bosh", "bin") )
117+
}
118+
119+
It "symlinks tar to \var\vcap\bosh\bin for backwards compatibility" {
120+
{ Install-CFFeatures -IaaS "ignored" } | Should -Not -Throw
121+
122+
Test-Path (Join-Path $depsDir "tar.exe") | Should -Be $True
123+
}
124+
125+
}
112126
}
113127

114128
Describe "Remove-DockerPackage" {

modules/BOSH.CFCell/BOSH.CFCell.psm1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ function Install-CFFeatures
3030
Write-Log "Setting WinRM startup type to automatic"
3131
Get-Service | Where-Object { $_.Name -eq "WinRM" } | Set-Service -StartupType Automatic
3232

33+
Write-Log "Creating symlink to system tar.exe"
34+
$link = "C:\var\vcap\bosh\bin\tar.exe"
35+
$target = "C:\Windows\system32\tar.exe"
36+
New-Item -Path $link -ItemType SymbolicLink -V $target
37+
3338
if ($ForceReboot -eq $true)
3439
{
3540
Restart-Computer

0 commit comments

Comments
 (0)