blob: fbd1080d4ada5b679b818a7b7c98bca044d0b15c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
*/
package updater
import (
"testing"
)
func TestUpdate(t *testing.T) {
update, err := CheckForUpdate()
if err != nil {
t.Error(err)
return
}
if update == nil {
t.Error("No update available")
return
}
t.Log("Found update")
progress := DownloadVerifyAndExecute(0, nil)
for {
dp := <-progress
if dp.Error != nil {
t.Error(dp.Error)
return
}
if len(dp.Activity) > 0 {
t.Log(dp.Activity)
}
if dp.BytesTotal > 0 {
t.Logf("Downloaded %d of %d", dp.BytesDownloaded, dp.BytesTotal)
}
if dp.Complete {
t.Log("Complete!")
break
}
}
}
|