You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: featuremanagement/targeting_test.go
+36-38Lines changed: 36 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -4,50 +4,48 @@
4
4
package featuremanagement
5
5
6
6
import (
7
-
"encoding/json"
8
7
"testing"
8
+
9
+
"github.com/go-viper/mapstructure/v2"
9
10
)
10
11
11
12
funcTestTargetingFilter(t*testing.T) {
12
-
// Define the test feature flag with complex targeting rules
13
-
jsonData:=`{
14
-
"id": "ComplexTargeting",
15
-
"description": "A feature flag using a targeting filter, that will return true for Alice, Stage1, and 50% of Stage2. Dave and Stage3 are excluded. The default rollout percentage is 25%.",
16
-
"enabled": true,
17
-
"conditions": {
18
-
"client_filters": [
19
-
{
20
-
"name": "Microsoft.Targeting",
21
-
"parameters": {
22
-
"audience": {
23
-
"users": [
24
-
"Alice"
25
-
],
26
-
"groups": [
27
-
{
28
-
"name": "Stage1",
29
-
"rollout_percentage": 100
30
-
},
31
-
{
32
-
"name": "Stage2",
33
-
"rollout_percentage": 50
34
-
}
35
-
],
36
-
"default_rollout_percentage": 25,
37
-
"exclusion": {
38
-
"users": ["Dave"],
39
-
"groups": ["Stage3"]
40
-
}
41
-
}
42
-
}
43
-
}
44
-
]
45
-
}
46
-
}`
13
+
featureFlagData:=map[string]any{
14
+
"ID": "ComplexTargeting",
15
+
"Description": "A feature flag using a targeting filter, that will return true for Alice, Stage1, and 50% of Stage2. Dave and Stage3 are excluded. The default rollout percentage is 25%.",
0 commit comments