tstest/natlab: make Machine constructible directly.

This is a prelude to adding more fields, which would otherwise
become more unnamed function params.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2020-07-03 02:42:25 +00:00
committed by Dave Anderson
parent d94593e884
commit 73db7e99ab
2 changed files with 13 additions and 18 deletions

View File

@@ -41,8 +41,8 @@ func TestAllocIPs(t *testing.T) {
func TestSendPacket(t *testing.T) {
internet := NewInternet()
foo := NewMachine("foo")
bar := NewMachine("bar")
foo := &Machine{Name: "foo"}
bar := &Machine{Name: "bar"}
ifFoo := foo.Attach("eth0", internet)
ifBar := bar.Attach("enp0s1", internet)
@@ -84,9 +84,9 @@ func TestMultiNetwork(t *testing.T) {
}
internet := NewInternet()
client := NewMachine("client")
nat := NewMachine("nat")
server := NewMachine("server")
client := &Machine{Name: "client"}
nat := &Machine{Name: "nat"}
server := &Machine{Name: "server"}
ifClient := client.Attach("eth0", lan)
ifNATWAN := nat.Attach("ethwan", internet)