controlclient, ipn: update tests for key pointer change

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
David Crawshaw 2020-02-11 04:52:50 -05:00 committed by David Crawshaw
parent 2f9cdd0aac
commit 33dfb8999e
3 changed files with 6 additions and 6 deletions

View File

@ -641,7 +641,7 @@ func TestRefresh(t *testing.T) {
if got := *exp; !nkey1Expiry.Equal(got) {
t.Errorf("node key expiry = %v, want %v", got, nkey1Expiry)
}
k := tailcfg.NodeKey(*c1.direct.persist.PrivateNodeKey.Public())
k := tailcfg.NodeKey(c1.direct.persist.PrivateNodeKey.Public())
if k != nkey1 {
t.Errorf("node key after 2 hours is %v, want %v", k, nkey1)
}
@ -1077,7 +1077,7 @@ func (c *client) status(t *testing.T) (status statusChange) {
} else {
t.Logf("%s state: %s", c.name, status.New.state)
if status.New.NetMap != nil {
c.mkey = tailcfg.MachineKey(*status.New.Persist.PrivateMachineKey.Public())
c.mkey = tailcfg.MachineKey(status.New.Persist.PrivateMachineKey.Public())
if nkey := status.New.NetMap.NodeKey; nkey != (tailcfg.NodeKey{}) && nkey != c.nkey {
c.nkey = nkey
c.id = c.s.control.DB().Node(c.nkey).ID

View File

@ -190,7 +190,7 @@ func TestClientsReusingOldKey(t *testing.T) {
if err != nil {
t.Fatal(err)
}
return *k
return k
}
// Replace the previous key with a new key.
@ -258,7 +258,7 @@ func TestClientsReusingOldKey(t *testing.T) {
// At this point, there should only be one node for the machine key
// registered as active in the server.
mkey := tailcfg.MachineKey(*persist1.PrivateMachineKey.Public())
mkey := tailcfg.MachineKey(persist1.PrivateMachineKey.Public())
nodeIDs, err := server.DB().MachineNodes(mkey)
if err != nil {
t.Fatal(err)

View File

@ -201,7 +201,7 @@ func newNode(t *testing.T, prefix string, https *httptest.Server) testNode {
// Tell the control server to authorize the given node.
func authNode(t *testing.T, ctl *control.Server, n *LocalBackend) {
mk := *n.prefs.Persist.PrivateMachineKey.Public()
nk := *n.prefs.Persist.PrivateNodeKey.Public()
mk := n.prefs.Persist.PrivateMachineKey.Public()
nk := n.prefs.Persist.PrivateNodeKey.Public()
ctl.AuthorizeMachine(tailcfg.MachineKey(mk), tailcfg.NodeKey(nk))
}