@@ -345,11 +345,25 @@ func Test_updater_run(t *testing.T) {
345
345
u := fromParams (p )
346
346
assertFileContent (t , p .Fakefs , fakeExePathLinux , fakeOldVersion )
347
347
err := u .Run (p .Ctx , false , fakeCoderURL , "" )
348
- assertCLIError (t , "update coder - cannot exec new binary" , err , "failed to check version of updated coder binary" , "" )
348
+ assertCLIError (t , "update coder - cannot exec new binary" , err , "failed to update coder binary" , fakeError . Error () )
349
349
assertFileContent (t , p .Fakefs , fakeExePathLinux , fakeOldVersion )
350
350
})
351
351
352
352
if runtime .GOOS == goosWindows {
353
+ run (t , "update coder - windows" , func (t * testing.T , p * params ) {
354
+ fakeFile (t , p .Fakefs , fakeExePathWindows , 0755 , fakeOldVersion )
355
+ p .HTTPClient .M [apiPrivateVersionURL ] = newFakeGetterResponse ([]byte (fakeNewVersionJSON ), 200 , variadicS (), nil )
356
+ p .HTTPClient .M [fakeGithubReleaseURL ] = newFakeGetterResponse ([]byte (fakeGithubReleaseJSON ), 200 , variadicS (), nil )
357
+ p .HTTPClient .M [fakeAssetURLLinux ] = newFakeGetterResponse (fakeValidTgzBytes , 200 , variadicS (), nil )
358
+ p .VersionF = func () string { return fakeOldVersion }
359
+ p .ConfirmF = fakeConfirmYes
360
+ p .OsF = func () string { return goosWindows }
361
+ u := fromParams (p )
362
+ assertFileContent (t , p .Fakefs , fakeExePathWindows , fakeOldVersion )
363
+ err := u .Run (p .Ctx , false , fakeCoderURL , "" )
364
+ assertCLIError (t , "update coder - cannot exec new binary" , err , "failed to update coder binary" , fakeError .Error ())
365
+ assertFileContent (t , p .Fakefs , fakeExePathWindows , fakeOldVersion )
366
+ })
353
367
run (t , "update coder - path blocklist - windows" , func (t * testing.T , p * params ) {
354
368
p .ExecutablePath = `C:\Windows\system32\coder.exe`
355
369
u := fromParams (p )
0 commit comments