| 914 | } |
| 915 | |
| 916 | func (n *TestNode) MustDown() { |
| 917 | t := n.env.t |
| 918 | t.Logf("Running down ...") |
| 919 | if err := n.Tailscale("down", "--accept-risk=all").Run(); err != nil { |
| 920 | t.Fatalf("down: %v", err) |
| 921 | } |
| 922 | |
| 923 | // The tailscale down command is asynchronous, so it returns early. |
| 924 | // Wait for tailscaled to drop its connection before continuing. |
| 925 | if err := tstest.WaitFor(time.Second, func() error { |
| 926 | if err := t.Context().Err(); err != nil { |
| 927 | return err |
| 928 | } |
| 929 | if c := n.env.Control.InServeMap(); c != 0 { |
| 930 | return fmt.Errorf("%d connections remaining in serve map", c) |
| 931 | } |
| 932 | return nil |
| 933 | }); err != nil { |
| 934 | t.Fatalf("tailscale down: %v", err) |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | func (n *TestNode) MustLogOut() { |
| 939 | t := n.env.t |