Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions build/testing/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,15 @@ segments:
value: buzz
`

expectedYAMLStreamOutput = `version: "1.3"
namespace: default
expectedYAMLStreamOutput = `version: "1.4"
namespace:
key: default
name: Default
description: Default namespace
---
namespace: foo
namespace:
key: foo
name: foo
flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
Expand Down Expand Up @@ -491,7 +496,9 @@ segments:
value: buzz
match_type: ALL_MATCH_TYPE
---
namespace: bar
namespace:
key: bar
name: bar
flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
Expand Down
8 changes: 2 additions & 6 deletions build/testing/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"math/big"
"os"
"path"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -46,7 +47,7 @@ func init() {
var (
protocolPorts = map[string]int{"http": 8080, "grpc": 9000}
replacer = strings.NewReplacer(" ", "-", "/", "-")
sema = make(chan struct{}, 6)
sema = make(chan struct{}, max(6, runtime.NumCPU()))

// AllCases are the top-level filterable integration test cases.
AllCases = map[string]testCaseFn{
Expand Down Expand Up @@ -627,11 +628,6 @@ func importExport(ctx context.Context, _ *dagger.Client, base, flipt *dagger.Con
return err
}

if ns == "default" {
// replace namespace in expected yaml
expected = strings.ReplaceAll(expected, "version: \"1.3\"\n", fmt.Sprintf("version: \"1.3\"\nnamespace: %s\n", ns))
}

if ns != "default" {
flags = append(flags, "--namespaces", ns)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: "1.3"
version: "1.4"
namespace:
key: default
name: Default
description: Default namespace
flags:
- key: flag_001
name: FLAG_001
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version: "1.3"
namespace: production
version: "1.4"
namespace:
key: production
name: Production
flags:
- key: flag_001
name: FLAG_001
Expand Down
53 changes: 26 additions & 27 deletions build/testing/testdata/flipt-namespace-foo.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
# exported by Flipt (dev) on 2020-02-24T14:57:19Z
namespace: foo
flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
segments:
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
104 changes: 52 additions & 52 deletions build/testing/testdata/flipt-yaml-stream.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
namespace: foo
flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
segments:
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
---
namespace: bar
flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
segments:
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
54 changes: 26 additions & 28 deletions build/testing/testdata/flipt.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# exported by Flipt (dev) on 2020-02-24T14:57:19Z

flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
description: description
enabled: true
variants:
- key: NGxfcVffpMhBz9n8
name: fhDHQ7rcxvoaWbHw
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
segments:
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
- key: 08UoVJ96LhZblPEx
name: 2oS8SHbrxyFkRg1a
description: description
constraints:
- type: STRING_COMPARISON_TYPE
property: foo
operator: eq
value: baz
- type: STRING_COMPARISON_TYPE
property: fizz
operator: neq
value: buzz
1 change: 0 additions & 1 deletion core/validation/extended.cue
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#Flag: {
description: =~"^.+$"
}

19 changes: 13 additions & 6 deletions core/validation/flipt.cue
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
version: "1.0" | "1.1" | "1.2" | *"1.3"
version: "1.0" | "1.1" | "1.2" | "1.3" | *"1.4"

close({
namespace: string & =~"^[-_,A-Za-z0-9]+$" | *"default"
version: version
namespace?: #Namespace
flags: [...#Flag]
segments: [...#Segment]
})

#Namespace: {
key: string & =~"^[-_,A-Za-z0-9]+$" | *"default"
name?: string & =~"^.+$"
description?: string
} | string & =~"^[-_,A-Za-z0-9]+$"

#Flag: {
key: string & =~"^[-_,A-Za-z0-9]+$"
name: string & =~"^.+$"
description?: string
enabled: bool | *false
variants: [...#Variant]
rules: [...#Rule]
if version == "1.1" || version == "1.2" || version == "1.3" {
if version == "1.1" || version == "1.2" || version == "1.3" || version == "1.4" {
type: "BOOLEAN_FLAG_TYPE" | *"VARIANT_FLAG_TYPE"
#FlagBoolean | *{}
}
if version == "1.3" {
if version == "1.3" || version == "1.4" {
metadata: [string]: (string | int | bool | float)
}
}
Expand All @@ -34,8 +41,8 @@ close({
key: string & =~"^.+$"
name?: string & =~"^.+$"
description?: string
attachment: {...} | [...] | *null
if version == "1.3" {
attachment: {...} | [...] | *null
if version == "1.3" || version == "1.4" {
default: bool | *false
}
}
Expand Down
5 changes: 4 additions & 1 deletion core/validation/testdata/valid.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace: default
namespace:
key: foo
name: foo
description: foo namespace
flags:
- key: flipt
name: flipt
Expand Down
Loading
Loading