[ARVADOS] updated: 2.1.0-1569-ga357f5f19
Git user
git at public.arvados.org
Mon Nov 1 21:59:04 UTC 2021
Summary of changes:
lib/install/deps.go | 2 +-
lib/install/deps_go_version_test.go | 40 +++++++++++++++++++++++++++++++++++++
tools/arvbox/bin/arvbox | 2 +-
3 files changed, 42 insertions(+), 2 deletions(-)
create mode 100644 lib/install/deps_go_version_test.go
via a357f5f197dbe54314608d4c5acbdd9e1959afba (commit)
from 3ce7895505f99de703ec750e4b0bf10334522b2d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a357f5f197dbe54314608d4c5acbdd9e1959afba
Author: Ward Vandewege <ward at curii.com>
Date: Mon Nov 1 17:56:50 2021 -0400
18313: add a test for the grep/awk command used in the arvbox code.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/lib/install/deps.go b/lib/install/deps.go
index ff00ee1e3..714604c84 100644
--- a/lib/install/deps.go
+++ b/lib/install/deps.go
@@ -29,6 +29,7 @@ import (
var Command cmd.Handler = &installCommand{}
const devtestDatabasePassword = "insecure_arvados_test"
+const goversion = "1.17.1"
type installCommand struct {
ClusterType string
@@ -245,7 +246,6 @@ make install
}
if !prod {
- goversion := "1.17.1"
if havegoversion, err := exec.Command("/usr/local/bin/go", "version").CombinedOutput(); err == nil && bytes.HasPrefix(havegoversion, []byte("go version go"+goversion+" ")) {
logger.Print("go " + goversion + " already installed")
} else {
diff --git a/lib/install/deps_go_version_test.go b/lib/install/deps_go_version_test.go
new file mode 100644
index 000000000..1a69b6e61
--- /dev/null
+++ b/lib/install/deps_go_version_test.go
@@ -0,0 +1,40 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package install
+
+import (
+ "bytes"
+ "os/exec"
+ "testing"
+
+ "gopkg.in/check.v1"
+)
+
+func Test(t *testing.T) {
+ check.TestingT(t)
+}
+
+var _ = check.Suite(&Suite{})
+
+type Suite struct{}
+
+/*
+ TestExtractGoVersion tests the grep/awk command used in
+ tools/arvbox/bin/arvbox to extract the version of Go to install for
+ bootstrapping `arvados-server`.
+
+ If this test is changed, the arvbox code will also need to be updated.
+*/
+func (*Suite) TestExtractGoVersion(c *check.C) {
+ script := `
+ sourcepath="$(realpath ../..)"
+ (cd ${sourcepath} && grep 'const goversion =' lib/install/deps.go |awk -F'"' '{print $2}')
+ `
+ cmd := exec.Command("bash", "-")
+ cmd.Stdin = bytes.NewBufferString("set -ex -o pipefail\n" + script)
+ cmdOutput, err := cmd.Output()
+ c.Assert(err, check.IsNil)
+ c.Assert(string(cmdOutput), check.Equals, goversion+"\n")
+}
diff --git a/tools/arvbox/bin/arvbox b/tools/arvbox/bin/arvbox
index 785a7708b..ca98ff63f 100755
--- a/tools/arvbox/bin/arvbox
+++ b/tools/arvbox/bin/arvbox
@@ -401,7 +401,7 @@ build() {
set -e
# Get the go version we should use for bootstrapping
- GO_VERSION=`grep 'goversion :=' $LOCAL_ARVADOS_ROOT/lib/install/deps.go |awk -F'"' '{print $2}'`
+ GO_VERSION=`grep 'const goversion =' $LOCAL_ARVADOS_ROOT/lib/install/deps.go |awk -F'"' '{print $2}'`
if test "$1" = localdemo -o "$1" = publicdemo ; then
BUILDTYPE=demo
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list