tstest/integration/vms: smoke test derphttp through mitm proxies

Updates #4377

Very smoky/high-level test to ensure that derphttp internals play well
with an agressive (stare + bump) meddler-in-the-middle proxy.

Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
Tom DNetto
2022-04-12 13:04:36 -07:00
committed by Tom
parent 2748750aa2
commit dec68166e4
5 changed files with 175 additions and 20 deletions

View File

@ -276,17 +276,14 @@ func testOneDistribution(t *testing.T, n int, distro Distro) {
t.Cleanup(func() { ramsem.sem.Release(int64(distro.MemoryMegs)) })
vm := h.mkVM(t, n, distro, h.pubKey, h.loginServerURL, dir)
var ipm ipMapping
vm.waitStartup(t)
for i := 0; i < 100; i++ {
if vm.running() {
break
}
time.Sleep(100 * time.Millisecond)
}
if !vm.running() {
t.Fatal("vm not running")
}
h.testDistro(t, distro, h.waitForIPMap(t, vm, distro))
}
func (h *Harness) waitForIPMap(t *testing.T, vm *vmInstance, distro Distro) ipMapping {
t.Helper()
var ipm ipMapping
waiter := time.NewTicker(time.Second)
defer waiter.Stop()
@ -305,13 +302,11 @@ func testOneDistribution(t *testing.T, n int, distro Distro) {
}
<-waiter.C
}
h.testDistro(t, distro, ipm)
return ipm
}
func (h *Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
func (h *Harness) setupSSHShell(t *testing.T, d Distro, ipm ipMapping) (*ssh.ClientConfig, *ssh.Client) {
signer := h.signer
loginServer := h.loginServerURL
t.Helper()
port := ipm.port
@ -350,6 +345,13 @@ func (h *Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
}
h.copyBinaries(t, d, cli)
return ccfg, cli
}
func (h *Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
loginServer := h.loginServerURL
ccfg, cli := h.setupSSHShell(t, d, ipm)
timeout := 30 * time.Second
t.Run("start-tailscale", func(t *testing.T) {