Skip to content

Commit

Permalink
correctly determine the plugin binary file in the directory
Browse files Browse the repository at this point in the history
  • Loading branch information
calvn committed Dec 9, 2019
1 parent 71eb9f3 commit 1a8e131
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions vault/logical_system_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 1a8e131

Please sign in to comment.