Move version out of SDK. (#14229)

Move version out of SDK.  For now it's a copy rather than move: the part not addressed by this change is sdk/helper/useragent.String, which we'll want to remove in favour of PluginString.  That will have to wait until we've removed uses of useragent.String from all builtins.
This commit is contained in:
Nick Cabatoff
2022-12-07 13:29:51 -05:00
committed by GitHub
parent b2354e5aed
commit 35df9489c7
47 changed files with 289 additions and 65 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/hashicorp/vault/sdk/helper/jsonutil"
"github.com/hashicorp/vault/sdk/helper/wrapping"
"github.com/hashicorp/vault/sdk/logical"
"github.com/hashicorp/vault/sdk/version"
)
func TestOpenAPI_Regex(t *testing.T) {
@@ -263,7 +262,7 @@ func TestOpenAPI_SpecialPaths(t *testing.T) {
{"foo/bar", []string{"a", "b", "foo/*"}, true, []string{"foo/baz/*"}, false},
}
for i, test := range tests {
doc := NewOASDocument()
doc := NewOASDocument("version")
path := Path{
Pattern: test.pattern,
}
@@ -528,7 +527,7 @@ func TestOpenAPI_OperationID(t *testing.T) {
}
for _, context := range []string{"", "bar"} {
doc := NewOASDocument()
doc := NewOASDocument("version")
err := documentPath(path1, nil, "kv", false, logical.TypeLogical, doc)
if err != nil {
t.Fatal(err)
@@ -592,7 +591,7 @@ func TestOpenAPI_CustomDecoder(t *testing.T) {
},
}
docOrig := NewOASDocument()
docOrig := NewOASDocument("version")
err := documentPath(p, nil, "kv", false, logical.TypeLogical, docOrig)
if err != nil {
t.Fatal(err)
@@ -655,7 +654,7 @@ func TestOpenAPI_CleanResponse(t *testing.T) {
func testPath(t *testing.T, path *Path, sp *logical.Paths, expectedJSON string) {
t.Helper()
doc := NewOASDocument()
doc := NewOASDocument("dummyversion")
if err := documentPath(path, sp, "kv", false, logical.TypeLogical, doc); err != nil {
t.Fatal(err)
}
@@ -701,7 +700,7 @@ func expected(name string) string {
panic(err)
}
content := strings.Replace(string(data), "<vault_version>", version.GetVersion().Version, 1)
content := strings.Replace(string(data), "<vault_version>", "dummyversion", 1)
return content
}