From 360095cd344862a0c018a39315c34f70a3fb3ff5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 24 Feb 2021 21:18:08 -0800 Subject: [PATCH] ipn: add tests for exit node pretty printing. Signed-off-by: David Anderson --- ipn/prefs_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ipn/prefs_test.go b/ipn/prefs_test.go index ad8905b03..1cb5d052f 100644 --- a/ipn/prefs_test.go +++ b/ipn/prefs_test.go @@ -14,6 +14,7 @@ import ( "time" "inet.af/netaddr" + "tailscale.com/tailcfg" "tailscale.com/tstest" "tailscale.com/types/persist" "tailscale.com/types/preftype" @@ -376,6 +377,20 @@ func TestPrefsPretty(t *testing.T) { "linux", `Prefs{ra=false mesh=false dns=false want=false routes=[] nf=off Persist{lm=, o=, n=[B1VKl] u=""}}`, }, + { + Prefs{ + ExitNodeIP: netaddr.MustParseIP("1.2.3.4"), + }, + "linux", + `Prefs{ra=false mesh=false dns=false want=false exit=1.2.3.4 routes=[] nf=off Persist=nil}`, + }, + { + Prefs{ + ExitNodeID: tailcfg.StableNodeID("myNodeABC"), + }, + "linux", + `Prefs{ra=false mesh=false dns=false want=false exit=myNodeABC routes=[] nf=off Persist=nil}`, + }, } for i, tt := range tests { got := tt.p.pretty(tt.os)