From 1a8e1318c5a7dacbd99f9e0114f37d5b44bda26d Mon Sep 17 00:00:00 2001 From: Calvin Leung Huang Date: Mon, 9 Dec 2019 15:53:19 -0800 Subject: [PATCH] correctly determine the plugin binary file in the directory --- vault/logical_system_integ_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vault/logical_system_integ_test.go b/vault/logical_system_integ_test.go index 261bad0a278b..f09bc6d4f8ba 100644 --- a/vault/logical_system_integ_test.go +++ b/vault/logical_system_integ_test.go @@ -5,7 +5,6 @@ import ( "io/ioutil" "os" "path/filepath" - "strings" "testing" "time" @@ -120,18 +119,19 @@ func TestSystemBackend_Plugin_MissingBinary(t *testing.T) { t.Fatalf("bad: response should not be nil") } - files, err := ioutil.ReadDir(cluster.TempDir) - if err != nil { - t.Fatal(err) - } - // Seal the cluster cluster.EnsureCoresSealed(t) // Simulate removal of the plugin binary + files, err := ioutil.ReadDir(cluster.TempDir) + if err != nil { + t.Fatal(err) + } var pluginBinFile string for _, file := range files { - if strings.Contains(file.Name(), t.Name()) { + // We cannot determine the exact file name since it depends how the test + // is ran, so we use file stats to filter out what we want. + if !file.IsDir() && file.Mode().Perm() == os.FileMode(0755) { pluginBinFile = file.Name() break }