feat(BRIDGE-278): Rollout Feature Flag stickiness support; a new UUID 'sticky' value has been added to the vault"
This commit is contained in:
@ -57,6 +57,7 @@ import (
|
||||
"github.com/bradenaw/juniper/xslices"
|
||||
"github.com/elastic/go-sysinfo/types"
|
||||
"github.com/go-resty/resty/v2"
|
||||
uuid "github.com/google/uuid"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -271,7 +272,7 @@ func newBridge(
|
||||
return nil, fmt.Errorf("failed to create focus service: %w", err)
|
||||
}
|
||||
|
||||
unleashService := unleash.NewBridgeService(ctx, api, locator, panicHandler)
|
||||
unleashService := unleash.NewBridgeService(ctx, api, locator, panicHandler, vault.GetFeatureFlagStickyKey())
|
||||
|
||||
observabilityService := observability.NewService(ctx, panicHandler)
|
||||
|
||||
@ -785,3 +786,7 @@ func (bridge *Bridge) SetHostVersionGetterTest(fn func(host types.Host) string)
|
||||
func (bridge *Bridge) SetRolloutPercentageTest(rollout float64) error {
|
||||
return bridge.vault.SetUpdateRollout(rollout)
|
||||
}
|
||||
|
||||
func (bridge *Bridge) GetFeatureFlagStickyKey() uuid.UUID {
|
||||
return bridge.vault.GetFeatureFlagStickyKey()
|
||||
}
|
||||
|
||||
@ -56,6 +56,7 @@ import (
|
||||
imapid "github.com/emersion/go-imap-id"
|
||||
"github.com/emersion/go-sasl"
|
||||
"github.com/emersion/go-smtp"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
)
|
||||
@ -778,6 +779,30 @@ func TestBridge_ChangeCacheDirectory(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestBridge_FeatureFlagStickyKey_Persistence(t *testing.T) {
|
||||
var uuidOne uuid.UUID
|
||||
var uuidTwo uuid.UUID
|
||||
|
||||
withEnv(t, func(ctx context.Context, s *server.Server, netCtl *proton.NetCtl, locator bridge.Locator, vaultKey []byte) {
|
||||
withBridge(ctx, t, s.GetHostURL(), netCtl, locator, vaultKey, func(b *bridge.Bridge, _ *bridge.Mocks) {
|
||||
uuidOne = b.GetFeatureFlagStickyKey()
|
||||
})
|
||||
withBridge(ctx, t, s.GetHostURL(), netCtl, locator, vaultKey, func(b *bridge.Bridge, _ *bridge.Mocks) {
|
||||
require.Equal(t, uuidOne, b.GetFeatureFlagStickyKey())
|
||||
})
|
||||
})
|
||||
|
||||
withEnv(t, func(ctx context.Context, s *server.Server, netCtl *proton.NetCtl, locator bridge.Locator, vaultKey []byte) {
|
||||
withBridge(ctx, t, s.GetHostURL(), netCtl, locator, vaultKey, func(b *bridge.Bridge, _ *bridge.Mocks) {
|
||||
uuidTwo = b.GetFeatureFlagStickyKey()
|
||||
require.NotEqual(t, uuidOne, uuidTwo)
|
||||
})
|
||||
withBridge(ctx, t, s.GetHostURL(), netCtl, locator, vaultKey, func(b *bridge.Bridge, _ *bridge.Mocks) {
|
||||
require.Equal(t, uuidTwo, b.GetFeatureFlagStickyKey())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestBridge_ChangeAddressOrder(t *testing.T) {
|
||||
withEnv(t, func(ctx context.Context, s *server.Server, netCtl *proton.NetCtl, locator bridge.Locator, vaultKey []byte) {
|
||||
// Create a user.
|
||||
|
||||
Reference in New Issue
Block a user