From 9b7fc2ed1f64068c2fb4987e7cf5439eacac9253 Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Tue, 31 Aug 2021 07:17:07 -0700 Subject: [PATCH] .github: add Ubuntu VM test Signed-off-by: David Crawshaw --- .../{xe-experimental-vm-test.yml => vm.yml} | 27 +++++++++---------- tstest/integration/vms/vm_setup_test.go | 7 ++--- 2 files changed, 17 insertions(+), 17 deletions(-) rename .github/workflows/{xe-experimental-vm-test.yml => vm.yml} (68%) diff --git a/.github/workflows/xe-experimental-vm-test.yml b/.github/workflows/vm.yml similarity index 68% rename from .github/workflows/xe-experimental-vm-test.yml rename to .github/workflows/vm.yml index 8c92bd0e0..ba5511bc0 100644 --- a/.github/workflows/xe-experimental-vm-test.yml +++ b/.github/workflows/vm.yml @@ -1,31 +1,30 @@ -name: "integration-vms" +name: VM on: pull_request: - paths: - - "tstest/integration/vms/**" - release: - types: [ created ] + branches: + - '*' jobs: - experimental-linux-vm-test: - # To set up a new runner, see tstest/integration/vms/runner.nix - runs-on: [ self-hosted, linux, vm_integration_test ] + ubuntu2004-LTS-cloud-base: + runs-on: [ self-hosted, linux, vm ] if: "!contains(github.event.head_commit.message, '[ci skip]')" steps: + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.17 + id: go + - name: Checkout Code uses: actions/checkout@v1 - - name: Download VM Images - run: go test ./tstest/integration/vms -run-vm-tests -run=Download -timeout=60m -no-s3 - env: - XDG_CACHE_HOME: "/var/lib/ghrunner/cache" - - name: Run VM tests - run: go test ./tstest/integration/vms -v -run-vm-tests + run: go test ./tstest/integration/vms -v -no-s3 -run-vm-tests -run=TestRunUbuntu2004 env: + HOME: "/tmp" TMPDIR: "/tmp" XDG_CACHE_HOME: "/var/lib/ghrunner/cache" diff --git a/tstest/integration/vms/vm_setup_test.go b/tstest/integration/vms/vm_setup_test.go index 0e94f7cfe..738b7d7c7 100644 --- a/tstest/integration/vms/vm_setup_test.go +++ b/tstest/integration/vms/vm_setup_test.go @@ -246,13 +246,14 @@ func fetchDistro(t *testing.T, resultDistro Distro) string { t.Fatalf("%s replied %s", resultDistro.URL, resp.Status) } - if _, err = io.Copy(fout, resp.Body); err != nil { + if n, err := io.Copy(fout, resp.Body); err != nil { t.Fatalf("download of %s failed: %v", resultDistro.URL, err) + } else if n == 0 { + t.Fatalf("download of %s got zero-length file", resultDistro.URL) } resp.Body.Close() - err = fout.Close() - if err != nil { + if err = fout.Close(); err != nil { t.Fatalf("can't close fout: %v", err) }