tstest/integration/vms: only build binaries once (#2042)

Previously this built the binaries for every distro. This is a bit
overkill given we are using static binaries. This patch makes us only
build once.

There was also a weird issue with how processes were being managed.
Previously we just killed qemu with Process.Kill(), however that was
leaving behind zombies. This has been mended to not only kill qemu but
also waitpid() the process so it doesn't become a zombie.

Updates #1988

Signed-off-by: Christine Dodrill <xe@tailscale.com>
pull/2044/head
Christine Dodrill 3 years ago committed by GitHub
parent a282819026
commit 0a655309c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -310,6 +310,8 @@ func mkVM(t *testing.T, n int, d Distro, sshKey, hostURL, tdir string) func() {
if err != nil {
t.Errorf("can't kill %s (%d): %v", d.name, cmd.Process.Pid, err)
}
cmd.Wait()
}
}
@ -440,6 +442,7 @@ func TestVMIntegrationEndToEnd(t *testing.T) {
defer tstest.UnfixLogs(t)
ramsem := semaphore.NewWeighted(int64(*vmRamLimit))
bins := integration.BuildTestBinaries(t)
t.Run("do", func(t *testing.T) {
for n, distro := range distros {
@ -481,13 +484,13 @@ func TestVMIntegrationEndToEnd(t *testing.T) {
}
})
testDistro(t, loginServer, signer, ipm)
testDistro(t, loginServer, signer, ipm, bins)
})
}
})
}
func testDistro(t *testing.T, loginServer string, signer ssh.Signer, ipm ipMapping) {
func testDistro(t *testing.T, loginServer string, signer ssh.Signer, ipm ipMapping, bins *integration.Binaries) {
t.Helper()
port := ipm.port
hostport := fmt.Sprintf("127.0.0.1:%d", port)
@ -523,7 +526,7 @@ func testDistro(t *testing.T, loginServer string, signer ssh.Signer, ipm ipMappi
if err != nil {
t.Fatal(err)
}
copyBinaries(t, cli)
copyBinaries(t, cli, bins)
timeout := 5 * time.Minute
@ -558,9 +561,7 @@ func testDistro(t *testing.T, loginServer string, signer ssh.Signer, ipm ipMappi
}
}
func copyBinaries(t *testing.T, conn *ssh.Client) {
bins := integration.BuildTestBinaries(t)
func copyBinaries(t *testing.T, conn *ssh.Client, bins *integration.Binaries) {
cli, err := sftp.NewClient(conn)
if err != nil {
t.Fatalf("can't connect over sftp to copy binaries: %v", err)

Loading…
Cancel
Save