@@ -22,7 +22,7 @@ import (
2222const BoshTimeout = 90 * time .Minute
2323
2424const GoZipFile = "go1.12.7.windows-amd64.zip"
25- const GolangURL = "https://storage.googleapis.com/golang /" + GoZipFile
25+ const GolangURL = "https://go.dev/dl /" + GoZipFile
2626const LgpoUrl = "https://download.microsoft.com/download/8/5/C/85C25433-A1B0-4FFA-9429-7E023E7DA8D8/LGPO.zip"
2727const lgpoFile = "LGPO.exe"
2828const windowsVersion = "windows-2019"
@@ -95,13 +95,16 @@ var _ = Describe("BOSH Windows", func() {
9595 It ("can run a job that relies on a package" , func () {
9696 time .Sleep (60 * time .Second )
9797 Eventually (
98- downloadLogs ("check-multiple" , " simple-job" , 0 , boshCommand ),
98+ downloadLogs ("check-multiple" , 0 , "./ simple-job/simple-job/job-service-wrapper.out.log" , boshCommand ),
9999 ).WithTimeout (time .Second * 65 ).Should (gbytes .Say ("60 seconds passed" ))
100100 })
101101
102102 It ("checks system dependencies and security, auto update has turned off, currently has a Service StartType of 'Manual' and initially had a StartType of 'Delayed', and password is randomized" , func () {
103103 err := boshCommand .RunErrand ("check-system" , deploymentName )
104- Expect (err ).NotTo (HaveOccurred ())
104+ if err != nil {
105+ downloadLogs ("check-multiple" , 0 , "./check-system/combined-output.log" , boshCommand )
106+ Expect (err ).NotTo (HaveOccurred ())
107+ }
105108 })
106109
107110 It ("is fully updated" , func () {
@@ -431,7 +434,7 @@ func (m ManifestProperties) toMap() map[string]string {
431434 return manifest
432435}
433436
434- func downloadLogs (instanceName string , jobName string , index int , bosh * BoshCommand ) * gbytes.Buffer {
437+ func downloadLogs (instanceName string , index int , logPath string , bosh * BoshCommand ) * gbytes.Buffer {
435438 tempDir := GinkgoT ().TempDir ()
436439
437440 err := bosh .Run (fmt .Sprintf ("--deployment=%s logs %s/%d --dir %s" , deploymentName , instanceName , index , tempDir ))
@@ -441,7 +444,7 @@ func downloadLogs(instanceName string, jobName string, index int, bosh *BoshComm
441444 Expect (err ).NotTo (HaveOccurred ())
442445 Expect (matches ).To (HaveLen (1 ))
443446
444- cmd := exec .Command ("tar" , "xf" , matches [0 ], "-O" , fmt . Sprintf ( "./%s/%s/job-service-wrapper.out.log" , jobName , jobName ) )
447+ cmd := exec .Command ("tar" , "xf" , matches [0 ], "-O" , logPath )
445448 session , err := gexec .Start (cmd , GinkgoWriter , GinkgoWriter )
446449 Expect (err ).NotTo (HaveOccurred ())
447450
@@ -467,6 +470,10 @@ func downloadFile(prefix, sourceUrl string) (string, error) {
467470 }
468471 defer res .Body .Close () //nolint:errcheck
469472
473+ if res .StatusCode < 200 || res .StatusCode >= 300 {
474+ return "" , fmt .Errorf ("failed to download file: HTTP %d %s" , res .StatusCode , res .Status )
475+ }
476+
470477 _ , err = io .Copy (f , res .Body )
471478 if err != nil {
472479 return "" , err
0 commit comments