Skip to content

Commit 48757f7

Browse files
committed
Stembuild: upload all powershell modules in setup
The Construct test suite has been relying on the BOSH.WinRM.psm1 module and not uploading the BOSH.Utils.psm1 module. When the WinRM code was updated to remove a duplicated `Write-Log` method this caused different behavior when it was executed without access to BOSH.Utils.psm1. This commit updates the test setup to upload both BOSH.WinRM.psm1 and BOSH.Utils.psm1.
1 parent a913df8 commit 48757f7

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

stembuild/integration/construct/construct_suite_test.go

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,26 @@ func enableWinRM() {
230230
repositoryRoot := filepath.Dir(filepath.Dir(filepath.Dir(filepath.Dir(currentFile))))
231231

232232
By("Enabling WinRM on the base image before integration tests...")
233-
winRMPowershellModule := filepath.Join(repositoryRoot, "modules", "BOSH.WinRM", "BOSH.WinRM.psm1")
234-
uploadCommand := []string{
235-
"guest.upload",
236-
fmt.Sprintf("-vm.ipath=%s", conf.VMInventoryPath),
237-
fmt.Sprintf("-u=%s", vcenterAdminCredentialUrl),
238-
fmt.Sprintf("-l=%s:%s", conf.VMUsername, conf.VMPassword),
239-
fmt.Sprintf("-tls-ca-certs=%s", pathToCACert),
240-
winRMPowershellModule,
241-
"C:\\Windows\\Temp\\BOSH.WinRM.psm1",
242-
}
233+
powershellModules := []string{"BOSH.Utils", "BOSH.WinRM"}
234+
235+
for _, powershellModule := range powershellModules {
236+
powershellModuleLocalPath := filepath.Join(repositoryRoot, "modules", powershellModule, fmt.Sprintf("%s.psm1", powershellModule))
237+
powershellModuleRemotePath := fmt.Sprintf("C:\\Windows\\Temp\\%s.psm1", powershellModule)
243238

244-
uploadExitCode := cli.Run(uploadCommand)
245-
Expect(uploadExitCode).To(Equal(0), fmt.Sprintf("There was an error uploading %s", winRMPowershellModule))
246-
By(fmt.Sprintf("WinRM '%s' uploaded", winRMPowershellModule))
239+
uploadCommand := []string{
240+
"guest.upload",
241+
fmt.Sprintf("-vm.ipath=%s", conf.VMInventoryPath),
242+
fmt.Sprintf("-u=%s", vcenterAdminCredentialUrl),
243+
fmt.Sprintf("-l=%s:%s", conf.VMUsername, conf.VMPassword),
244+
fmt.Sprintf("-tls-ca-certs=%s", pathToCACert),
245+
powershellModuleLocalPath,
246+
powershellModuleRemotePath,
247+
}
248+
249+
uploadExitCode := cli.Run(uploadCommand)
250+
Expect(uploadExitCode).To(Equal(0), fmt.Sprintf("error uploading %s to %s", powershellModuleLocalPath, powershellModuleRemotePath))
251+
By(fmt.Sprintf("'%s' was uploaded to '%s'", powershellModuleLocalPath, powershellModuleRemotePath))
252+
}
247253

248254
enableCommand := []string{
249255
"guest.start",

0 commit comments

Comments
 (0)