aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/updater/updater_test.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-28 12:27:06 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-29 08:41:30 +0200
commite9682162ac908e9b9d81f3378faf8b38d1baa630 (patch)
tree1c3e6059569376c72336ba09f06e9a5ee5e1e833 /updater/updater_test.go
parentgo.mod: use forked winio with no thirdparty deps (diff)
downloadwireguard-windows-e9682162ac908e9b9d81f3378faf8b38d1baa630.tar.xz
wireguard-windows-e9682162ac908e9b9d81f3378faf8b38d1baa630.zip
updater: add initial skeleton
Diffstat (limited to 'updater/updater_test.go')
-rw-r--r--updater/updater_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/updater/updater_test.go b/updater/updater_test.go
new file mode 100644
index 00000000..7bc4df8e
--- /dev/null
+++ b/updater/updater_test.go
@@ -0,0 +1,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()
+ 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
+ }
+ }
+}