Skip to content

Commit e15de90

Browse files
author
markphelps
committed
fix: update tests to handle ID fields in export
The PR flipt-io#4359 adds ID fields to rollouts and constraints in the export. This change updates the tests to handle these new fields properly: 1. CLI tests now check for individual fields rather than exact YAML blocks since IDs are included between the fields 2. Integration tests strip ID fields using regex before comparison since IDs are server-generated UUIDs and not stable across import/export This preserves the PR's intent (adding IDs to exports) while fixing tests. Signed-off-by: markphelps <[email protected]>
1 parent 9f99771 commit e15de90

19 files changed

+1248
-828
lines changed

build/testing/cli.go

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,20 @@ exit $?`,
180180
return err
181181
}
182182

183+
// Check export contains expected structure
184+
// Note: We check parts separately since IDs are now included in export
183185
if _, err = assertExec(ctx, container,
184186
flipt("export"),
185-
stdout(contains(expectedFliptYAML)),
187+
stdout(contains("key: zUFtS7D0UyMeueYu")),
188+
stdout(contains("name: UAoZRksg94r1iipa")),
189+
stdout(contains("type: VARIANT_FLAG_TYPE")),
190+
stdout(contains("segment: 08UoVJ96LhZblPEx")),
191+
stdout(contains("key: 08UoVJ96LhZblPEx")),
192+
stdout(contains("name: 2oS8SHbrxyFkRg1a")),
193+
stdout(contains("type: STRING_COMPARISON_TYPE")),
194+
stdout(contains("property: foo")),
195+
stdout(contains("operator: eq")),
196+
stdout(contains("value: baz")),
186197
); err != nil {
187198
return err
188199
}
@@ -199,8 +210,16 @@ exit $?`,
199210
return err
200211
}
201212

202-
if !strings.Contains(contents, expectedFliptYAML) {
203-
return fmt.Errorf("unexpected output: %q does not contain %q", contents, expectedFliptYAML)
213+
// Check file contains expected content (checking parts since IDs are now included)
214+
if !strings.Contains(contents, "key: zUFtS7D0UyMeueYu") ||
215+
!strings.Contains(contents, "name: UAoZRksg94r1iipa") ||
216+
!strings.Contains(contents, "type: VARIANT_FLAG_TYPE") ||
217+
!strings.Contains(contents, "segment: 08UoVJ96LhZblPEx") ||
218+
!strings.Contains(contents, "key: 08UoVJ96LhZblPEx") ||
219+
!strings.Contains(contents, "type: STRING_COMPARISON_TYPE") ||
220+
!strings.Contains(contents, "property: foo") ||
221+
!strings.Contains(contents, "value: baz") {
222+
return fmt.Errorf("exported file missing expected content")
204223
}
205224
}
206225

@@ -239,9 +258,17 @@ exit $?`,
239258
return err
240259
}
241260

261+
// Check export with namespace contains expected structure
242262
if _, err = assertExec(ctx, container,
243263
flipt("export", "--namespaces", "foo"),
244-
stdout(contains(expectedFliptYAML)),
264+
stdout(contains("key: zUFtS7D0UyMeueYu")),
265+
stdout(contains("name: UAoZRksg94r1iipa")),
266+
stdout(contains("type: VARIANT_FLAG_TYPE")),
267+
stdout(contains("segment: 08UoVJ96LhZblPEx")),
268+
stdout(contains("key: 08UoVJ96LhZblPEx")),
269+
stdout(contains("type: STRING_COMPARISON_TYPE")),
270+
stdout(contains("property: foo")),
271+
stdout(contains("value: baz")),
245272
); err != nil {
246273
return err
247274
}
@@ -258,8 +285,16 @@ exit $?`,
258285
return err
259286
}
260287

261-
if !strings.Contains(contents, expectedFliptYAML) {
262-
return fmt.Errorf("unexpected output: %q does not contain %q", contents, expectedFliptYAML)
288+
// Check file contains expected content (checking parts since IDs are now included)
289+
if !strings.Contains(contents, "key: zUFtS7D0UyMeueYu") ||
290+
!strings.Contains(contents, "name: UAoZRksg94r1iipa") ||
291+
!strings.Contains(contents, "type: VARIANT_FLAG_TYPE") ||
292+
!strings.Contains(contents, "segment: 08UoVJ96LhZblPEx") ||
293+
!strings.Contains(contents, "key: 08UoVJ96LhZblPEx") ||
294+
!strings.Contains(contents, "type: STRING_COMPARISON_TYPE") ||
295+
!strings.Contains(contents, "property: foo") ||
296+
!strings.Contains(contents, "value: baz") {
297+
return fmt.Errorf("exported file missing expected content")
263298
}
264299
}
265300

@@ -280,9 +315,18 @@ exit $?`,
280315
return err
281316
}
282317

318+
// Check export contains expected namespaces and structure
283319
if _, err := assertExec(ctx, container,
284320
flipt("export", "--all-namespaces"),
285-
stdout(contains(expectedYAMLStreamOutput)),
321+
stdout(contains("namespace:\n key: default")),
322+
stdout(contains("namespace:\n key: foo")),
323+
stdout(contains("namespace:\n key: bar")),
324+
stdout(contains("key: zUFtS7D0UyMeueYu")),
325+
stdout(contains("type: VARIANT_FLAG_TYPE")),
326+
stdout(contains("key: 08UoVJ96LhZblPEx")),
327+
stdout(contains("type: STRING_COMPARISON_TYPE")),
328+
stdout(contains("property: foo")),
329+
stdout(contains("value: baz")),
286330
); err != nil {
287331
return err
288332
}
@@ -305,9 +349,18 @@ exit $?`,
305349
return err
306350
}
307351

352+
// Check sorted export contains expected structure (checking key parts)
308353
if _, err := assertExec(ctx, container,
309354
flipt("export", "--namespace", "foo,bar", "--sort-by-key"),
310-
stdout(contains(expectedFliptSortedOutput)),
355+
stdout(contains("namespace:\n key: foo")),
356+
stdout(contains("namespace:\n key: bar")),
357+
stdout(contains("key: FLag2")),
358+
stdout(contains("key: flag1")),
359+
stdout(contains("key: flag2")),
360+
stdout(contains("key: segment1")),
361+
stdout(contains("key: segment2")),
362+
stdout(contains("type: BOOLEAN_FLAG_TYPE")),
363+
stdout(contains("type: VARIANT_FLAG_TYPE")),
311364
); err != nil {
312365
return err
313366
}
@@ -330,9 +383,17 @@ exit $?`,
330383
return err
331384
}
332385

386+
// Check sorted all-namespaces export contains expected structure
333387
if _, err := assertExec(ctx, container,
334388
flipt("export", "--all-namespaces", "--sort-by-key"),
335-
stdout(contains(expectedFliptSortedAllNamespacesOutput)),
389+
stdout(contains("namespace:\n key: bar")),
390+
stdout(contains("namespace:\n key: default")),
391+
stdout(contains("namespace:\n key: foo")),
392+
stdout(contains("key: FLag2")),
393+
stdout(contains("key: flag1")),
394+
stdout(contains("key: flag2")),
395+
stdout(contains("key: segment1")),
396+
stdout(contains("key: segment2")),
336397
); err != nil {
337398
return err
338399
}

build/testing/integration.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"math/big"
1515
"os"
1616
"path"
17+
"regexp"
1718
"runtime"
1819
"strconv"
1920
"strings"
@@ -648,6 +649,18 @@ func importExport(ctx context.Context, _ *dagger.Client, base, flipt *dagger.Con
648649
// remove line that starts with comment character '#' and newline after
649650
generated = generated[strings.Index(generated, "\n")+2:]
650651

652+
// Remove ID fields from constraints and rollouts before comparison
653+
// IDs are server-generated UUIDs and not stable across import/export
654+
// Using regex to remove id: lines from the YAML
655+
idLineRegex := regexp.MustCompile(`(?m)^\s*- id: "[^"]*"\n`)
656+
expected = idLineRegex.ReplaceAllString(expected, "")
657+
generated = idLineRegex.ReplaceAllString(generated, "")
658+
659+
// Also handle case where id is not first in the list
660+
idFieldRegex := regexp.MustCompile(`(?m)^\s+id: "[^"]*"\n`)
661+
expected = idFieldRegex.ReplaceAllString(expected, "")
662+
generated = idFieldRegex.ReplaceAllString(generated, "")
663+
651664
diff := cmp.Diff(expected, generated)
652665
if diff != "" {
653666
fmt.Printf("Unexpected difference in %q exported output: \n", conf.name)

go.work.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,11 @@ cloud.google.com/go/auth v0.12.1/go.mod h1:BFMu+TNpF3DmvfBO9ClqTR/SiqVIm7LukKF9m
176176
cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q=
177177
cloud.google.com/go/auth v0.14.0/go.mod h1:CYsoRL1PdiDuqeQpZE0bP2pnPrGqFcOkI0nldEQis+A=
178178
cloud.google.com/go/auth v0.16.0/go.mod h1:1howDHJ5IETh/LwYs3ZxvlkXF48aSqqJUM+5o02dNOI=
179+
cloud.google.com/go/auth v0.16.1/go.mod h1:1howDHJ5IETh/LwYs3ZxvlkXF48aSqqJUM+5o02dNOI=
179180
cloud.google.com/go/auth v0.16.2 h1:QvBAGFPLrDeoiNjyfVunhQ10HKNYuOwZ5noee0M5df4=
180181
cloud.google.com/go/auth v0.16.2/go.mod h1:sRBas2Y1fB1vZTdurouM0AzuYQBMZinrUYL8EufhtEA=
182+
cloud.google.com/go/auth v0.16.3/go.mod h1:NucRGjaXfzP1ltpcQ7On/VTZ0H4kWB5Jy+Y9Dnm76fA=
183+
cloud.google.com/go/auth v0.16.4/go.mod h1:j10ncYwjX/g3cdX7GpEzsdM+d+ZNsXAbb6qXA7p1Y5M=
181184
cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q=
182185
cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I=
183186
cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc=
@@ -301,6 +304,7 @@ cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1h
301304
cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
302305
cloud.google.com/go/compute/metadata v0.5.1/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k=
303306
cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k=
307+
cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo=
304308
cloud.google.com/go/contactcenterinsights v1.13.1/go.mod h1:/3Ji8Rr1GS6d+/MOwlXM2gZPSuvTKIFyf8OG+7Pe5r8=
305309
cloud.google.com/go/contactcenterinsights v1.13.6/go.mod h1:mL+DbN3pMQGaAbDC4wZhryLciwSwHf5Tfk4Itr72Zyk=
306310
cloud.google.com/go/contactcenterinsights v1.14.0/go.mod h1:APmWYHDN4sASnUBnXs4o68t1EUfnqadA53//CzXZ1xE=
@@ -865,6 +869,7 @@ cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502Jw
865869
cloud.google.com/go/storage v1.49.0/go.mod h1:k1eHhhpLvrPjVGfo0mOUPEJ4Y2+a/Hv5PiwehZI9qGU=
866870
cloud.google.com/go/storage v1.51.0/go.mod h1:YEJfu/Ki3i5oHC/7jyTgsGZwdQ8P9hqMqvpi5kRKGgc=
867871
cloud.google.com/go/storage v1.53.0/go.mod h1:7/eO2a/srr9ImZW9k5uufcNahT2+fPb8w5it1i5boaA=
872+
cloud.google.com/go/storage v1.56.0/go.mod h1:Tpuj6t4NweCLzlNbw9Z9iwxEkrSem20AetIeH/shgVU=
868873
cloud.google.com/go/storagetransfer v1.10.5/go.mod h1:086WXPZlWXLfql+/nlmcc8ZzFWvITqfSGUQyMdf5eBk=
869874
cloud.google.com/go/storagetransfer v1.10.10/go.mod h1:8+nX+WgQ2ZJJnK8e+RbK/zCXk8T7HdwyQAJeY7cEcm0=
870875
cloud.google.com/go/storagetransfer v1.11.0/go.mod h1:arcvgzVC4HPcSikqV8D4h4PwrvGQHfKtbL4OwKPirjs=
@@ -1944,6 +1949,7 @@ github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBH
19441949
github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E=
19451950
github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A=
19461951
github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk=
1952+
github.com/googleapis/gax-go/v2 v2.14.2/go.mod h1:ON64QhlJkhVtSqp4v1uaK92VyZ2gmvDQsweuyLV+8+w=
19471953
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
19481954
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
19491955
github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
@@ -3562,8 +3568,11 @@ google.golang.org/api v0.216.0/go.mod h1:K9wzQMvWi47Z9IU7OgdOofvZuw75Ge3PPITImZR
35623568
google.golang.org/api v0.224.0/go.mod h1:3V39my2xAGkodXy0vEqcEtkqgw2GtrFL5WuBZlCTCOQ=
35633569
google.golang.org/api v0.229.0/go.mod h1:wyDfmq5g1wYJWn29O22FDWN48P7Xcz0xz+LBpptYvB0=
35643570
google.golang.org/api v0.232.0/go.mod h1:p9QCfBWZk1IJETUdbTKloR5ToFdKbYh2fkjsUL6vNoY=
3571+
google.golang.org/api v0.234.0/go.mod h1:QpeJkemzkFKe5VCE/PMv7GsUfn9ZF+u+q1Q7w6ckxTg=
3572+
google.golang.org/api v0.239.0/go.mod h1:cOVEm2TpdAGHL2z+UwyS+kmlGr3bVWQQ6sYEqkKje50=
35653573
google.golang.org/api v0.242.0 h1:7Lnb1nfnpvbkCiZek6IXKdJ0MFuAZNAJKQfA1ws62xg=
35663574
google.golang.org/api v0.242.0/go.mod h1:cOVEm2TpdAGHL2z+UwyS+kmlGr3bVWQQ6sYEqkKje50=
3575+
google.golang.org/api v0.246.0/go.mod h1:dMVhVcylamkirHdzEBAIQWUCgqY885ivNeZYd7VAVr8=
35673576
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
35683577
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
35693578
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -3693,6 +3702,7 @@ google.golang.org/genproto/googleapis/api v0.0.0-20250512202823-5a2f75b736a9/go.
36933702
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237/go.mod h1:ezi0AVyMKDWy5xAncvjLWH7UcLBB5n7y2fQ8MzjJcto=
36943703
google.golang.org/genproto/googleapis/api v0.0.0-20250528174236-200df99c418a/go.mod h1:a77HrdMjoeKbnd2jmgcWdaS++ZLZAEq3orIOAEIKiVw=
36953704
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:kXqgZtrWaf6qS3jZOCnCH7WYfrvFjkC51bM8fz3RsCA=
3705+
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074/go.mod h1:vYFwMYFbmA8vl6Z/krj/h7+U/AqpHknwJX4Uqgfyc7I=
36963706
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs=
36973707
google.golang.org/genproto/googleapis/bytestream v0.0.0-20240429193739-8cf5692501f6/go.mod h1:ULqtoQMxDLNRfW+pJbKA68wtIy1OiYjdIsJs3PMpzh8=
36983708
google.golang.org/genproto/googleapis/bytestream v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:5/MT647Cn/GGhwTpXC7QqcaR5Cnee4v4MKCU1/nwnIQ=
@@ -3707,6 +3717,7 @@ google.golang.org/genproto/googleapis/bytestream v0.0.0-20250414145226-207652e42
37073717
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250512202823-5a2f75b736a9/go.mod h1:h6yxum/C2qRb4txaZRLDHK8RyS0H/o2oEDeKY4onY/Y=
37083718
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250603155806-513f23925822 h1:zWFRixYR5QlotL+Uv3YfsPRENIrQFXiGs+iwqel6fOQ=
37093719
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250603155806-513f23925822/go.mod h1:h6yxum/C2qRb4txaZRLDHK8RyS0H/o2oEDeKY4onY/Y=
3720+
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:h6yxum/C2qRb4txaZRLDHK8RyS0H/o2oEDeKY4onY/Y=
37103721
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
37113722
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I=
37123723
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY=
@@ -3762,6 +3773,7 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237/go.
37623773
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
37633774
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
37643775
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
3776+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
37653777
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
37663778
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
37673779
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=

internal/ext/testdata/export.json

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,98 @@
1-
{"version":"1.4","namespace":{"key":"default","name":"default","description":"default namespace"},"flags":[{"key":"flag1","name":"flag1","type":"VARIANT_FLAG_TYPE","description":"description","enabled":true,"metadata":{"area":true,"label":"variant"},"variants":[{"key":"variant1","name":"variant1","attachment":{"answer":{"everything":42},"happy":true,"list":[1,0,2],"name":"Niels","nothing":null,"object":{"currency":"USD","value":42.99},"pi":3.141}},{"default":true,"key":"foo"}],"rules":[{"segment":"segment1","distributions":[{"variant":"variant1","rollout":100}]},{"segment":{"keys":["segment1","segment2"],"operator":"AND_SEGMENT_OPERATOR"}}]},{"key":"flag2","name":"flag2","type":"BOOLEAN_FLAG_TYPE","description":"a boolean flag","enabled":false,"metadata":{"area":12,"label":"bool"},"rollouts":[{"id":"1","description":"enabled for internal users","segment":{"key":"internal_users","value":true}},{"id":"2","description":"enabled for 50%","threshold":{"percentage":50,"value":true}}]}],"segments":[{"key":"segment1","name":"segment1","description":"description","constraints":[{"id":"1","type":"STRING_COMPARISON_TYPE","property":"foo","operator":"eq","value":"baz","description":"desc"},{"id":"2","type":"STRING_COMPARISON_TYPE","property":"fizz","operator":"neq","value":"buzz","description":"desc"}],"match_type":"ANY_MATCH_TYPE"},{"key":"segment2","name":"segment2","description":"description","match_type":"ANY_MATCH_TYPE"}]}
1+
{
2+
"version": "1.4",
3+
"namespace": {
4+
"key": "default",
5+
"name": "default",
6+
"description": "default namespace"
7+
},
8+
"flags": [
9+
{
10+
"key": "flag1",
11+
"name": "flag1",
12+
"type": "VARIANT_FLAG_TYPE",
13+
"description": "description",
14+
"enabled": true,
15+
"metadata": { "area": true, "label": "variant" },
16+
"variants": [
17+
{
18+
"key": "variant1",
19+
"name": "variant1",
20+
"attachment": {
21+
"answer": { "everything": 42 },
22+
"happy": true,
23+
"list": [1, 0, 2],
24+
"name": "Niels",
25+
"nothing": null,
26+
"object": { "currency": "USD", "value": 42.99 },
27+
"pi": 3.141
28+
}
29+
},
30+
{ "default": true, "key": "foo" }
31+
],
32+
"rules": [
33+
{
34+
"segment": "segment1",
35+
"distributions": [{ "variant": "variant1", "rollout": 100 }]
36+
},
37+
{
38+
"segment": {
39+
"keys": ["segment1", "segment2"],
40+
"operator": "AND_SEGMENT_OPERATOR"
41+
}
42+
}
43+
]
44+
},
45+
{
46+
"key": "flag2",
47+
"name": "flag2",
48+
"type": "BOOLEAN_FLAG_TYPE",
49+
"description": "a boolean flag",
50+
"enabled": false,
51+
"metadata": { "area": 12, "label": "bool" },
52+
"rollouts": [
53+
{
54+
"id": "1",
55+
"description": "enabled for internal users",
56+
"segment": { "key": "internal_users", "value": true }
57+
},
58+
{
59+
"id": "2",
60+
"description": "enabled for 50%",
61+
"threshold": { "percentage": 50, "value": true }
62+
}
63+
]
64+
}
65+
],
66+
"segments": [
67+
{
68+
"key": "segment1",
69+
"name": "segment1",
70+
"description": "description",
71+
"constraints": [
72+
{
73+
"id": "1",
74+
"type": "STRING_COMPARISON_TYPE",
75+
"property": "foo",
76+
"operator": "eq",
77+
"value": "baz",
78+
"description": "desc"
79+
},
80+
{
81+
"id": "2",
82+
"type": "STRING_COMPARISON_TYPE",
83+
"property": "fizz",
84+
"operator": "neq",
85+
"value": "buzz",
86+
"description": "desc"
87+
}
88+
],
89+
"match_type": "ANY_MATCH_TYPE"
90+
},
91+
{
92+
"key": "segment2",
93+
"name": "segment2",
94+
"description": "description",
95+
"match_type": "ANY_MATCH_TYPE"
96+
}
97+
]
98+
}

0 commit comments

Comments
 (0)