@@ -100,36 +100,48 @@ Describe "Install-CFFeatures" {
100100 Mock - ModuleName BOSH.CFCell Write-Log { }
101101 Mock - ModuleName BOSH.CFCell Get-WinRMConfig { " Some config" }
102102 Mock - ModuleName BOSH.CFCell WindowsFeatureInstall { }
103- Mock Uninstall-WindowsFeature { }
104103 Mock - ModuleName BOSH.CFCell Uninstall-WindowsFeature { }
105104 Mock - ModuleName BOSH.CFCell Set-Service { }
106105 Mock - ModuleName BOSH.CFCell Restart-Computer { }
107- Mock - ModuleName BOSH.CFCell Get-OSVersionString { " 10.0.1803" }
108106 }
109107
110108 It " triggers a machine restart when the -ForceReboot flag is set" {
111- { Install-CFFeatures - IaaS " ignored " - ForceReboot } | Should -Not - Throw
109+ { Install-CFFeatures - IaaS " not-vsphere " - ForceReboot } | Should -Not - Throw
112110
113111 Assert-MockCalled Restart-Computer - Times 1 - Scope It - ModuleName BOSH.CFCell
114112 }
115113
116114 It " doesn't trigger a machine restart if -ForceReboot flag not set" {
117- { Install-CFFeatures - IaaS " ignored " } | Should -Not - Throw
115+ { Install-CFFeatures - IaaS " not-vsphere " } | Should -Not - Throw
118116
119117 Assert-MockCalled Restart-Computer - Times 0 - Scope It - ModuleName BOSH.CFCell
120118 }
121119
122120 It " logs Installing CloudFoundry Cell Windows Features" {
123- { Install-CFFeatures - IaaS " ignored " } | Should -Not - Throw
121+ { Install-CFFeatures - IaaS " not-vsphere " } | Should -Not - Throw
124122
125123 Assert-MockCalled Write-Log - Times 1 - Scope It - ModuleName BOSH.CFCell - ParameterFilter { $Message -eq " Installing CloudFoundry Cell Windows Features" }
126124 }
127125
128126 It " logs Installed CloudFoundry Cell Windows Features after installation" {
129- { Install-CFFeatures - IaaS " ignored " } | Should -Not - Throw
127+ { Install-CFFeatures - IaaS " not-vsphere " } | Should -Not - Throw
130128
131129 Assert-MockCalled Write-Log - Times 1 - Scope It - ModuleName BOSH.CFCell - ParameterFilter { $Message -eq " Installed CloudFoundry Cell Windows Features" }
132130 }
131+
132+ It " calls Uninstall-WindowsFeature (for '*Defender')" {
133+ { Install-CFFeatures - IaaS " not-vsphere" } | Should -Not - Throw
134+
135+ Should - Invoke - ModuleName BOSH.CFCell - CommandName Uninstall-WindowsFeature
136+ }
137+
138+ Context " when -IaaS is 'vsphere'" {
139+ It " does not call Uninstall-WindowsFeature (for '*Defender')" {
140+ { Install-CFFeatures - IaaS " vsphere" } | Should -Not - Throw
141+
142+ Should -Not - Invoke - ModuleName BOSH.CFCell - CommandName Uninstall-WindowsFeature
143+ }
144+ }
133145}
134146
135147Describe " Remove-DockerPackage" {
0 commit comments