From 49e7120caf0cda5b46f871411cc47eed053f48c2 Mon Sep 17 00:00:00 2001 From: John-Michael Faircloth Date: Thu, 23 Feb 2023 17:07:48 +0000 Subject: [PATCH] backport of commit f4f1762991680e26f854db0aabb4927b5cfe58cd --- vault/external_tests/plugin/plugin_test.go | 2 ++ vault/testing.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/vault/external_tests/plugin/plugin_test.go b/vault/external_tests/plugin/plugin_test.go index b72d0f9a7c01..c0380bf56d62 100644 --- a/vault/external_tests/plugin/plugin_test.go +++ b/vault/external_tests/plugin/plugin_test.go @@ -423,6 +423,8 @@ func testPlugin_continueOnError(t *testing.T, btype logical.BackendType, mismatc // Get the registered plugin req := logical.TestRequest(t, logical.ReadOperation, fmt.Sprintf("sys/plugins/catalog/%s/mock-plugin", pluginType)) + // We are using the mock backend from vault/sdk/plugin/mock/backend.go which sets the plugin version. + req.Data["version"] = "v0.0.0+mock" req.ClientToken = core.Client.Token() resp, err := core.HandleRequest(namespace.RootContext(testCtx), req) if err != nil || resp == nil || (resp != nil && resp.IsError()) { diff --git a/vault/testing.go b/vault/testing.go index da3c72e33cab..1d4a18a22428 100644 --- a/vault/testing.go +++ b/vault/testing.go @@ -539,6 +539,9 @@ func TestAddTestPlugin(t testing.T, c *Core, name string, pluginType consts.Plug if err != nil { t.Fatal(err) } + // Ensure that the file is closed and written. This seems to be + // necessary on Linux systems. + out.Close() dirPath = tempDir }