aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/updater/updater_test.go
diff options
context:
space:
mode:
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
+ }
+ }
+}