mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-28 23:39:07 +01:00
[management] Keep embedded IdP deployments on a single account (#7380)
This commit is contained in:
@@ -5,8 +5,12 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/netbirdio/netbird/shared/management/grpc"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
nbconfig "github.com/netbirdio/netbird/management/internals/server/config"
|
||||
"github.com/netbirdio/netbird/management/server/idp"
|
||||
"github.com/netbirdio/netbird/shared/management/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -60,6 +64,22 @@ func Test_LoadMgmtConfig_Empty(t *testing.T) {
|
||||
assert.Nil(t, cfg.PerAccountHighestSupportedSyncMessageVersion)
|
||||
}
|
||||
|
||||
func TestApplyEmbeddedIdPConfigRequiresSingleAccountDomain(t *testing.T) {
|
||||
previousDomain := mgmtSingleAccModeDomain
|
||||
previousDisabled := disableSingleAccMode
|
||||
t.Cleanup(func() {
|
||||
mgmtSingleAccModeDomain = previousDomain
|
||||
disableSingleAccMode = previousDisabled
|
||||
})
|
||||
|
||||
mgmtSingleAccModeDomain = ""
|
||||
disableSingleAccMode = false
|
||||
cfg := &nbconfig.Config{
|
||||
EmbeddedIdP: &idp.EmbeddedIdPConfig{Enabled: true},
|
||||
}
|
||||
require.ErrorContains(t, ApplyEmbeddedIdPConfig(context.Background(), cfg), "embedded IdP requires single account mode")
|
||||
}
|
||||
|
||||
func createConfig(config string) (string, error) {
|
||||
tmpfile, err := os.CreateTemp("", "config.json")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user