summaryrefslogtreecommitdiffhomepage
path: root/version/updates/updates_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2021-09-29 12:19:16 -0700
committerBrad Fitzpatrick <bradfitz@tailscale.com>2021-09-29 12:21:27 -0700
commitd39e972e595a2f39526f323584e2991863c27502 (patch)
treef70b37637020e6af83e84126abe685e9ac53fcae /version/updates/updates_test.go
parent0fa1da2d1b1a89102a6199b99ce3c07e725aade0 (diff)
downloadtailscale-bradfitz/updates.tar.xz
tailscale-bradfitz/updates.zip
version/updates: start of version updates policy packagebradfitz/updates
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'version/updates/updates_test.go')
-rw-r--r--version/updates/updates_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/version/updates/updates_test.go b/version/updates/updates_test.go
new file mode 100644
index 000000000..491a3eae1
--- /dev/null
+++ b/version/updates/updates_test.go
@@ -0,0 +1,28 @@
+// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package updates
+
+import (
+ "bytes"
+ "os"
+ "testing"
+
+ "github.com/tailscale/hujson"
+)
+
+func TestParse(t *testing.T) {
+ rulesJSON, err := os.ReadFile("rules.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ d := hujson.NewDecoder(bytes.NewReader(rulesJSON))
+ d.DisallowUnknownFields()
+
+ var p Policy
+ if err := d.Decode(&p); err != nil {
+ t.Fatal(err)
+ }
+}