From 794eb8b2e9dbc1e8fa2f13e1dc14fc6ed9e82894 Mon Sep 17 00:00:00 2001 From: Christopher Swenson Date: Thu, 23 Feb 2023 15:10:13 -0800 Subject: [PATCH] When copying test binary, delete first (#19331) For plugin tests, we copy the test binary. On macOS, if the destination binary already exists, then copying over it will result in an invalid signature. The easiest workaround is to delete the file before copying. --- vault/testing.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vault/testing.go b/vault/testing.go index c539bd2b6ecc..8cccdfd50681 100644 --- a/vault/testing.go +++ b/vault/testing.go @@ -526,6 +526,9 @@ func TestAddTestPlugin(t testing.T, c *Core, name string, pluginType consts.Plug // Copy over the file to the temp dir dst := filepath.Join(tempDir, fileName) + + // delete the file first to avoid notary failures in macOS + _ = os.Remove(dst) // ignore error out, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { t.Fatal(err)