mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-17 04:01:41 +00:00
Added single node test to check Addresses and AllowedIPs
Signed-off-by: Simeng He <simeng@tailscale.com>
This commit is contained in:
parent
13b94cc4d7
commit
d36c7a40b4
@ -196,6 +196,37 @@ func TestTwoNodes(t *testing.T) {
|
|||||||
d2.MustCleanShutdown(t)
|
d2.MustCleanShutdown(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNodeAddressIPFields(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
bins := buildTestBinaries(t)
|
||||||
|
|
||||||
|
env := newTestEnv(t, bins)
|
||||||
|
defer env.Close()
|
||||||
|
|
||||||
|
n1 := newTestNode(t, env)
|
||||||
|
d1 := n1.StartDaemon(t)
|
||||||
|
defer d1.Kill()
|
||||||
|
|
||||||
|
n1.AwaitListening(t)
|
||||||
|
n1.MustUp()
|
||||||
|
n1.AwaitRunning(t)
|
||||||
|
|
||||||
|
testNodes := env.Control.AllNodes()
|
||||||
|
|
||||||
|
if len(testNodes) != 1 {
|
||||||
|
t.Errorf("Expected %d nodes, got %d", 1, len(testNodes))
|
||||||
|
}
|
||||||
|
node := testNodes[0]
|
||||||
|
if len(node.Addresses) == 0 {
|
||||||
|
t.Errorf("Empty Addresses field in node")
|
||||||
|
}
|
||||||
|
if len(node.AllowedIPs) == 0 {
|
||||||
|
t.Errorf("Empty AllowedIPs field in node")
|
||||||
|
}
|
||||||
|
|
||||||
|
d1.MustCleanShutdown(t)
|
||||||
|
}
|
||||||
|
|
||||||
// testBinaries are the paths to a tailscaled and tailscale binary.
|
// testBinaries are the paths to a tailscaled and tailscale binary.
|
||||||
// These can be shared by multiple nodes.
|
// These can be shared by multiple nodes.
|
||||||
type testBinaries struct {
|
type testBinaries struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user