ci: allow about to succeed if major & minor version of go match
@@ -16,6 +16,7 @@ package tests
import (
"encoding/json"
+ "regexp"
"runtime"
"testing"
@@ -39,7 +40,7 @@ func TestAboutCommands(t *testing.T) {
stdout, _ := e.RunCommand("pulumi", "about", "--json")
var res interface{}
assert.NoError(t, json.Unmarshal([]byte(stdout), &res), "Should be valid json")
- assert.Contains(t, stdout, runtime.Version())
+ assert.Contains(t, stdout, runtimeMajorMinor())
assert.Contains(t, stdout, runtime.Compiler)
assert.Contains(t, stdout, "Failed to get information about the current stack:")
})
@@ -55,7 +56,14 @@ func TestAboutCommands(t *testing.T) {
integration.CreateBasicPulumiRepo(e)
e.SetBackend(e.LocalURL())
stdout, _ := e.RunCommand("pulumi", "about")
- assert.Contains(t, stdout, runtime.Version())
+ assert.Contains(t, stdout, runtimeMajorMinor())
assert.Contains(t, stdout, runtime.Compiler)
})
}
+
+// Given a runtime version like "go1.17.123", returns "go1.17.", trimming patch and prerelease
+// values.
+func runtimeMajorMinor() string {
+ re := regexp.MustCompile(`go\d+.\d+.`)
+ return re.FindString(runtime.Version())
+}
