keychain: always ensure the default key is generated

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-06-17 17:05:14 +02:00
parent a4e31949a3
commit 687c0e33a4
3 changed files with 54 additions and 18 deletions

View File

@@ -8,12 +8,15 @@ import (
"testing"
"github.com/stretchr/testify/require"
"go.dagger.io/dagger/keychain"
"gopkg.in/yaml.v3"
)
func TestWorkspace(t *testing.T) {
ctx := context.TODO()
keychain.EnsureDefaultKey(ctx)
root, err := os.MkdirTemp(os.TempDir(), "dagger-*")
require.NoError(t, err)
@@ -60,6 +63,8 @@ func TestWorkspace(t *testing.T) {
func TestEncryption(t *testing.T) {
ctx := context.TODO()
keychain.EnsureDefaultKey(ctx)
readManifest := func(st *State) *State {
data, err := os.ReadFile(path.Join(st.Path, manifestFile))
require.NoError(t, err)