zero: bootstrap config (#4444)

This commit is contained in:
Denis Mishin 2023-08-16 12:47:46 -04:00 committed by GitHub
parent 65c0f6b70f
commit 788376bf60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 695 additions and 28 deletions

View file

@ -0,0 +1,30 @@
package bootstrap_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/pomerium/pomerium/internal/zero/bootstrap"
)
func TestConfigDeterministic(t *testing.T) {
secret := []byte("secret")
src, err := bootstrap.New(secret)
require.NoError(t, err)
cfg := src.GetConfig()
require.NotNil(t, cfg)
// test that the config is valid
require.NoError(t, cfg.Options.Validate())
// test that the config is deterministic
src2, err := bootstrap.New(secret)
require.NoError(t, err)
cfg2 := src2.GetConfig()
require.NotNil(t, cfg2)
require.Equal(t, cfg.Options, cfg2.Options)
}