Skip to content

Commit 2325746

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 1517199 commit 2325746

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-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.

0 commit comments

Comments
 (0)