aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-11-23 20:33:50 +0300
committerGitHub <noreply@github.com>2022-11-23 20:33:50 +0300
commitc4648ab98cdeeb520e7e629c5db4a471ec802954 (patch)
treef7f10e225e46f4ce4b6a71e5564345abb1b13e30 /test
parent173c7ca3c7ad646e6b9732b5af8d45f08606182e (diff)
go: fix bug - Go doesn't update version if go is already installed (#303)
* go: fix bug - Go doesn't update version if go is already installed * Update tests with bash -c
Diffstat (limited to 'test')
-rw-r--r--test/go/install_go_tool_in_postCreate.sh6
-rw-r--r--test/go/install_go_twice.sh11
-rw-r--r--test/go/scenarios.json8
-rwxr-xr-xtest/go/test.sh2
4 files changed, 23 insertions, 4 deletions
diff --git a/test/go/install_go_tool_in_postCreate.sh b/test/go/install_go_tool_in_postCreate.sh
index dbb086c..54637d9 100644
--- a/test/go/install_go_tool_in_postCreate.sh
+++ b/test/go/install_go_tool_in_postCreate.sh
@@ -5,9 +5,9 @@ set -e
# Optional: Import test library
source dev-container-features-test-lib
-check "mkcert version" mkcert --version | grep "v1.4.2"
-check "mkcert is installed at correct path" which mkcert | grep "/go/bin/mkcert"
-check "golangci-lint version" golangci-lint --version | grep "golangci-lint has version 1.50.0"
+check "mkcert version" bash -c "mkcert --version | grep v1.4.2"
+check "mkcert is installed at correct path" bash -c "which mkcert | grep /go/bin/mkcert"
+check "golangci-lint version" bash -c "golangci-lint --version | grep 'golangci-lint has version 1.50.0'"
# Report result
reportResults
diff --git a/test/go/install_go_twice.sh b/test/go/install_go_twice.sh
new file mode 100644
index 0000000..8f6ef54
--- /dev/null
+++ b/test/go/install_go_twice.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check "go-version" bash -c "go version | grep 1.19"
+
+# Report result
+reportResults
diff --git a/test/go/scenarios.json b/test/go/scenarios.json
index b3fe49c..86e1270 100644
--- a/test/go/scenarios.json
+++ b/test/go/scenarios.json
@@ -8,5 +8,13 @@
}
},
"postCreateCommand": "go install filippo.io/mkcert@v1.4.2"
+ },
+ "install_go_twice": {
+ "image": "mcr.microsoft.com/devcontainers/go:1.18",
+ "features": {
+ "go": {
+ "version": "1.19"
+ }
+ }
}
}
diff --git a/test/go/test.sh b/test/go/test.sh
index ee9f171..ccae6da 100755
--- a/test/go/test.sh
+++ b/test/go/test.sh
@@ -7,7 +7,7 @@ source dev-container-features-test-lib
check "version" go version
check "revive version" revive --version
-check "revive is installed at correct path" which revive | grep "/go/bin/revive"
+check "revive is installed at correct path" bash -c "which revive | grep /go/bin/revive"
# Report result
reportResults \ No newline at end of file