Skip to content

Commit

Permalink
fixup! fixup! Fix test of Agent plugin: KeyManager "disk"
Browse files Browse the repository at this point in the history
Signed-off-by: Ryuma Yoshida <[email protected]>
  • Loading branch information
ryysud committed May 7, 2019
1 parent 60b8ea5 commit 50964a0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/agent/plugin/keymanager/disk/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
"path"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -61,15 +62,20 @@ func TestDisk_FetchPrivateKey(t *testing.T) {
}

func TestDisk_Configure(t *testing.T) {
tempDir, err := ioutil.TempDir("", "km-disk-test")
require.NoError(t, err)
defer os.RemoveAll(tempDir)

keysDir := filepath.Join(tempDir, "keys")

plugin := New()
tmpdir := os.TempDir()
cReq := &spi.ConfigureRequest{
Configuration: fmt.Sprintf("directory = \"%s\"", tmpdir),
Configuration: fmt.Sprintf("directory = \"%s\"", keysDir),
}
_, e := plugin.Configure(ctx, cReq)
assert.NoError(t, e)
assert.Equal(t, tmpdir, plugin.dir)
assert.DirExists(t, tmpdir)
assert.Equal(t, keysDir, plugin.dir)
assert.DirExists(t, keysDir)
}

func TestDisk_GetPluginInfo(t *testing.T) {
Expand Down

0 comments on commit 50964a0

Please sign in to comment.