mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-16 22:59:04 +02:00
Co-authored-by: Eve <eve@multica-ai.local> Co-authored-by: multica-agent <github@multica.ai>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package handler
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/multica-ai/multica/server/internal/featureflags"
|
|
"github.com/multica-ai/multica/server/pkg/featureflag"
|
|
)
|
|
|
|
func withComposioMCPAppsFlag(t *testing.T, h *Handler, enabled bool) {
|
|
withFeatureFlag(t, h, featureflags.ComposioMCPApps, enabled)
|
|
}
|
|
|
|
func withAgentBuilderFlag(t *testing.T, h *Handler, enabled bool) {
|
|
withFeatureFlag(t, h, featureflags.AgentBuilder, enabled)
|
|
}
|
|
|
|
func withResourceLabelsFlag(t *testing.T, h *Handler, enabled bool) {
|
|
withFeatureFlag(t, h, featureflags.ResourceLabels, enabled)
|
|
}
|
|
|
|
func withFeatureFlag(t *testing.T, h *Handler, key string, enabled bool) {
|
|
t.Helper()
|
|
provider := featureflag.NewStaticProvider()
|
|
provider.Set(key, featureflag.Rule{Default: enabled})
|
|
flags := featureflag.NewService(provider)
|
|
|
|
origHandlerFlags := h.FeatureFlags
|
|
h.FeatureFlags = flags
|
|
var origTaskFlags *featureflag.Service
|
|
if h.TaskService != nil {
|
|
origTaskFlags = h.TaskService.FeatureFlags
|
|
h.TaskService.FeatureFlags = flags
|
|
}
|
|
t.Cleanup(func() {
|
|
h.FeatureFlags = origHandlerFlags
|
|
if h.TaskService != nil {
|
|
h.TaskService.FeatureFlags = origTaskFlags
|
|
}
|
|
})
|
|
}
|