mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-20 12:37:16 +02:00
zero: bootstrap config (#4444)
This commit is contained in:
parent
5ddfc74645
commit
c0b1309e90
8 changed files with 694 additions and 20 deletions
33
internal/zero/bootstrap/file_test.go
Normal file
33
internal/zero/bootstrap/file_test.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package bootstrap_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/zero/bootstrap"
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
cluster_api "github.com/pomerium/zero-sdk/cluster"
|
||||
)
|
||||
|
||||
func TestFile(t *testing.T) {
|
||||
cipher, err := cryptutil.NewAEADCipher(cryptutil.NewKey())
|
||||
require.NoError(t, err)
|
||||
|
||||
txt := "test"
|
||||
src := cluster_api.BootstrapConfig{
|
||||
DatabrokerStorageConnection: &txt,
|
||||
}
|
||||
|
||||
fd, err := os.CreateTemp(t.TempDir(), "test.data")
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fd.Close())
|
||||
|
||||
require.NoError(t, bootstrap.SaveBootstrapConfigToFile(&src, fd.Name(), cipher))
|
||||
|
||||
dst, err := bootstrap.LoadBootstrapConfigFromFile(fd.Name(), cipher)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, src, *dst)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue