@@ -98,11 +98,11 @@ Describe "Write-AgentConfig" {
9898 Test-Path $configPath | Should Be $True
9999 }
100100
101- It " disables ephemeral disk mounting by default" {
101+ It " enables ephemeral disk mounting by default" {
102102 { Write-AgentConfig - BoshDir $boshDir - IaaS aws } | Should Not Throw
103103 $configPath = (Join-Path $boshDir " agent.json" )
104104 Test-Path $configPath | Should Be $True
105- ($configPath ) | Should -Not - FileContentMatch ' EnableEphemeralDiskMounting'
105+ ($configPath ) | Should - FileContentMatch ' EnableEphemeralDiskMounting'
106106 }
107107
108108 It " enables ephemeral disk mounting when the flag is true" {
@@ -154,11 +154,11 @@ Describe "Write-AgentConfig" {
154154 ($configPath ) | Should - FileContentMatch ([regex ]::New(' "Metadata-Flavor":\s*"Google"' ))
155155 }
156156
157- It " disables ephemeral disk mounting by default" {
157+ It " enables ephemeral disk mounting by default" {
158158 { Write-AgentConfig - BoshDir $boshDir - IaaS gcp } | Should Not Throw
159159 $configPath = (Join-Path $boshDir " agent.json" )
160160 Test-Path $configPath | Should Be $True
161- ($configPath ) | Should -Not - FileContentMatch ' EnableEphemeralDiskMounting'
161+ ($configPath ) | Should - FileContentMatch ' EnableEphemeralDiskMounting'
162162 }
163163
164164 It " enables ephemeral disk mounting when the flag is true" {
@@ -178,11 +178,11 @@ Describe "Write-AgentConfig" {
178178 $configContent.Infrastructure.Settings.Sources [0 ].Type | Should Be " CDROM"
179179 }
180180
181- It " disables ephemeral disk mounting by default" {
181+ It " enables ephemeral disk mounting by default" {
182182 { Write-AgentConfig - BoshDir $boshDir - IaaS vsphere } | Should Not Throw
183183 $configPath = (Join-Path $boshDir " agent.json" )
184184 Test-Path $configPath | Should Be $True
185- ($configPath ) | Should -Not - FileContentMatch ' EnableEphemeralDiskMounting'
185+ ($configPath ) | Should - FileContentMatch ' EnableEphemeralDiskMounting'
186186 }
187187
188188 It " enables ephemeral disk mounting when the flag is true" {
@@ -238,18 +238,47 @@ Describe "Install-Agent" {
238238 }
239239 }
240240
241- It " calls helper functions with default arguments" {
242- Mock - Verifiable - ModuleName BOSH.Agent Copy-Agent {} - ParameterFilter { $InstallDir -eq " C:\" -and $agentZipPath -eq " some-agent-zip-path" }
241+ Context " windows 2012R2" {
242+ It " calls helper functions with default arguments" {
243+ Mock Get-OSVersion { " windows2012R2" } - ModuleName BOSH.Agent
244+ Mock Test-Path { $true } - ModuleName BOSH.Agent
243245
244- Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $path -eq " C:\bosh" }
245- Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $path -eq " C:\var" }
246- Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $path -eq " C:\Windows\Panther" -and $disableInheritance -eq $false }
246+ Mock - Verifiable - ModuleName BOSH.Agent Copy-Agent {} - ParameterFilter { $InstallDir -eq " C:\" -and $agentZipPath -eq " some-agent-zip-path" }
247247
248- Mock - Verifiable - ModuleName BOSH.Agent Write-AgentConfig {} - ParameterFilter { $IaaS -eq " aws" -and $BoshDir -eq " C:\bosh" -and $EnableEphemeralDiskMounting -eq $false }
249- Mock - Verifiable - ModuleName BOSH.Agent Set-Path {} - ParameterFilter { $Path -eq " C:\var\vcap\bosh\bin" }
250- Mock - Verifiable - ModuleName BOSH.Agent Install-AgentService {}
251- Install-Agent - IaaS aws - agentZipPath " some-agent-zip-path"
252- Assert-VerifiableMock
248+ Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $path -eq " C:\bosh" }
249+ Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $path -eq " C:\var" }
250+ Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $path -eq " C:\Windows\Panther" -and $disableInheritance -eq $false }
251+
252+ Mock - Verifiable - ModuleName BOSH.Agent Write-AgentConfig {} - ParameterFilter { $IaaS -eq " aws" -and $BoshDir -eq " C:\bosh" -and $EnableEphemeralDiskMounting -eq $false }
253+ Mock - Verifiable - ModuleName BOSH.Agent Set-Path {} - ParameterFilter { $Path -eq " C:\var\vcap\bosh\bin" }
254+ Mock - Verifiable - ModuleName BOSH.Agent Install-AgentService {}
255+
256+ Install-Agent - IaaS aws - agentZipPath " some-agent-zip-path"
257+
258+ Assert-VerifiableMock
259+ Assert-MockCalled Get-OSVersion - Times 1 - Scope It - ModuleName BOSH.Agent
260+ }
261+ }
262+
263+ Context " windows 2016" {
264+ It " calls helper functions with default arguments" {
265+ Mock Get-OSVersion { " window2016" } - ModuleName BOSH.Agent
266+ Mock Test-Path { $true } - ModuleName BOSH.Agent
267+
268+ Mock - Verifiable - ModuleName BOSH.Agent Copy-Agent {} - ParameterFilter { $InstallDir -eq " C:\" -and $agentZipPath -eq " some-agent-zip-path" }
269+ Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $Path -eq " C:\bosh" }
270+ Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $Path -eq " C:\var" }
271+ Mock - Verifiable - ModuleName BOSH.Agent Protect-Dir {} - ParameterFilter { $Path -eq " C:\Windows\Panther" -and $disableInheritance -eq $false }
272+
273+ Mock - Verifiable - ModuleName BOSH.Agent Write-AgentConfig {} - ParameterFilter { $IaaS -eq " aws" -and $BoshDir -eq " C:\bosh" -and $EnableEphemeralDiskMounting -eq $true }
274+ Mock - Verifiable - ModuleName BOSH.Agent Set-Path {} - ParameterFilter { $Path -eq " C:\var\vcap\bosh\bin" }
275+ Mock - Verifiable - ModuleName BOSH.Agent Install-AgentService {}
276+
277+ Install-Agent - IaaS aws - agentZipPath " some-agent-zip-path"
278+
279+ Assert-VerifiableMock
280+ Assert-MockCalled Get-OSVersion - Times 1 - Scope It - ModuleName BOSH.Agent
281+ }
253282 }
254283}
255284
0 commit comments