mirror of https://github.com/databricks/cli.git
wip finer grained server regex
This commit is contained in:
parent
09791fc16a
commit
e22b015434
|
@ -58,7 +58,8 @@ func NewFromConfig(t testutil.TestingT, path string) *Server {
|
|||
ctx, replacements := testdiff.WithReplacementsMap(context.Background())
|
||||
testdiff.PrepareReplacementOS(t, replacements)
|
||||
testdiff.PrepareReplacementsUUID(t, replacements)
|
||||
testdiff.PrepareReplacementsSemver(t, replacements)
|
||||
testdiff.PrepareReplacementVersions(t, replacements)
|
||||
// testdiff.PrepareReplacementsSemver(t, replacements)
|
||||
|
||||
server := New(ctx, t)
|
||||
for _, apiSpec := range apiSpecs {
|
||||
|
|
|
@ -9,10 +9,13 @@ import (
|
|||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/databricks/cli/internal/build"
|
||||
"github.com/databricks/cli/internal/testutil"
|
||||
"github.com/databricks/cli/libs/iamutil"
|
||||
"github.com/databricks/databricks-sdk-go"
|
||||
"github.com/databricks/databricks-sdk-go/service/iam"
|
||||
"github.com/databricks/databricks-sdk-go/version"
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -198,6 +201,28 @@ func PrepareReplacementsTemporaryDirectory(t testutil.TestingT, r *ReplacementsC
|
|||
r.append(privatePathRegex, "/tmp/.../$3")
|
||||
}
|
||||
|
||||
// cli/0.0.0-dev databricks-sdk-go/0.55.0 go/1.23.4 os/darwin cmd/jobs_create cmd-exec-id/2222ca79-6a7e-4e8a-9e89-73392f8a2f09 auth/pat
|
||||
|
||||
func PrepareReplacementVersions(t testutil.TestingT, r *ReplacementsContext) {
|
||||
t.Helper()
|
||||
r.Set(version.Version, "$GO_SDK_VERSION")
|
||||
|
||||
buildInfo := build.GetInfo()
|
||||
// test build versions can contain build metadata in their semver. Add a regex to match that.
|
||||
// TODO: This does not work. Fix it.
|
||||
cliVersionRegex := regexp.MustCompile(buildInfo.Version + `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?`)
|
||||
r.append(cliVersionRegex, "$CLI_VERSION")
|
||||
|
||||
r.Set(goVersion(), "$GO_VERSION")
|
||||
}
|
||||
|
||||
func goVersion() string {
|
||||
gv := runtime.Version()
|
||||
ssv := strings.ReplaceAll(gv, "go", "v")
|
||||
sv := semver.Canonical(ssv)
|
||||
return strings.TrimPrefix(sv, "v")
|
||||
}
|
||||
|
||||
func PrepareReplacementsSemver(t testutil.TestingT, r *ReplacementsContext) {
|
||||
t.Helper()
|
||||
r.append(semverRegex, "[SEMVER]")
|
||||
|
|
Loading…
Reference in New Issue