Merge branch '21461-excessive-scrollbars-fix'. Closes #21461
[arvados.git] / lib / install / deps_go_version_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package install
6
7 import (
8         "bytes"
9         "os/exec"
10         "testing"
11
12         "gopkg.in/check.v1"
13 )
14
15 func Test(t *testing.T) {
16         check.TestingT(t)
17 }
18
19 var _ = check.Suite(&Suite{})
20
21 type Suite struct{}
22
23 // TestExtractGoVersion tests the grep/awk command used in
24 // tools/arvbox/bin/arvbox to extract the version of Go to install for
25 // bootstrapping `arvados-server`.
26 //
27 // If this test is changed, the arvbox code will also need to be updated.
28 func (*Suite) TestExtractGoVersion(c *check.C) {
29         script := `
30   sourcepath="$(realpath ../..)"
31   (cd ${sourcepath} && grep 'const goversion =' lib/install/deps.go |awk -F'"' '{print $2}')
32         `
33         cmd := exec.Command("bash", "-")
34         cmd.Stdin = bytes.NewBufferString("set -ex -o pipefail\n" + script)
35         cmdOutput, err := cmd.Output()
36         c.Assert(err, check.IsNil)
37         c.Assert(string(cmdOutput), check.Equals, goversion+"\n")
38 }