Skip to content

Commit

Permalink
test: Fix bug in TestAddTestPlugin test helper (#19313)
Browse files Browse the repository at this point in the history
* fix external plugin test failing locally

* Ensure file is closed and written in TestAddTestPlugin
  • Loading branch information
fairclothjm authored Feb 23, 2023
1 parent 20b347e commit f4f1762
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vault/external_tests/plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
3 changes: 3 additions & 0 deletions vault/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f4f1762

Please sign in to comment.