summaryrefslogtreecommitdiffhomepage
path: root/types/key/control_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'types/key/control_test.go')
-rw-r--r--types/key/control_test.go76
1 files changed, 38 insertions, 38 deletions
diff --git a/types/key/control_test.go b/types/key/control_test.go
index a98a586f3..06e0f36d5 100644
--- a/types/key/control_test.go
+++ b/types/key/control_test.go
@@ -1,38 +1,38 @@
-// Copyright (c) Tailscale Inc & AUTHORS
-// SPDX-License-Identifier: BSD-3-Clause
-
-package key
-
-import (
- "encoding/json"
- "testing"
-)
-
-func TestControlKey(t *testing.T) {
- serialized := `{"PrivateKey":[36,132,249,6,73,141,249,49,9,96,49,60,240,217,253,57,3,69,248,64,178,62,121,73,121,88,115,218,130,145,68,254]}`
- want := ControlPrivate{
- MachinePrivate{
- k: [32]byte{36, 132, 249, 6, 73, 141, 249, 49, 9, 96, 49, 60, 240, 217, 253, 57, 3, 69, 248, 64, 178, 62, 121, 73, 121, 88, 115, 218, 130, 145, 68, 254},
- },
- }
-
- var got struct {
- PrivateKey ControlPrivate
- }
- if err := json.Unmarshal([]byte(serialized), &got); err != nil {
- t.Fatalf("decoding serialized ControlPrivate: %v", err)
- }
-
- if !got.PrivateKey.mkey.Equal(want.mkey) {
- t.Fatalf("Serialized ControlPrivate didn't deserialize as expected, got %v want %v", got.PrivateKey, want)
- }
-
- bs, err := json.Marshal(got)
- if err != nil {
- t.Fatalf("json reserialization of ControlPrivate failed: %v", err)
- }
-
- if got, want := string(bs), serialized; got != want {
- t.Fatalf("ControlPrivate didn't round-trip, got %q want %q", got, want)
- }
-}
+// Copyright (c) Tailscale Inc & AUTHORS
+// SPDX-License-Identifier: BSD-3-Clause
+
+package key
+
+import (
+ "encoding/json"
+ "testing"
+)
+
+func TestControlKey(t *testing.T) {
+ serialized := `{"PrivateKey":[36,132,249,6,73,141,249,49,9,96,49,60,240,217,253,57,3,69,248,64,178,62,121,73,121,88,115,218,130,145,68,254]}`
+ want := ControlPrivate{
+ MachinePrivate{
+ k: [32]byte{36, 132, 249, 6, 73, 141, 249, 49, 9, 96, 49, 60, 240, 217, 253, 57, 3, 69, 248, 64, 178, 62, 121, 73, 121, 88, 115, 218, 130, 145, 68, 254},
+ },
+ }
+
+ var got struct {
+ PrivateKey ControlPrivate
+ }
+ if err := json.Unmarshal([]byte(serialized), &got); err != nil {
+ t.Fatalf("decoding serialized ControlPrivate: %v", err)
+ }
+
+ if !got.PrivateKey.mkey.Equal(want.mkey) {
+ t.Fatalf("Serialized ControlPrivate didn't deserialize as expected, got %v want %v", got.PrivateKey, want)
+ }
+
+ bs, err := json.Marshal(got)
+ if err != nil {
+ t.Fatalf("json reserialization of ControlPrivate failed: %v", err)
+ }
+
+ if got, want := string(bs), serialized; got != want {
+ t.Fatalf("ControlPrivate didn't round-trip, got %q want %q", got, want)
+ }
+}