From 0a655309c6fccaf7f141d3f5293a31a1c4eab479 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Thu, 3 Jun 2021 10:58:35 -0400 Subject: [PATCH] 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 --- tstest/integration/vms/vms_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tstest/integration/vms/vms_test.go b/tstest/integration/vms/vms_test.go index 7b72d6d3a..fc534749b 100644 --- a/tstest/integration/vms/vms_test.go +++ b/tstest/integration/vms/vms_test.go @@ -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)