Skip to content

Commit

Permalink
feat(ext): add support for flag type and rollout definitions (#1826)
Browse files Browse the repository at this point in the history
* test(ext): add failing cases for new version 1.1 and rollouts

* feat(ext): add support for flag type and rollout definitions

* fix(ext): adding missing error not-nil check

* test(readonly): bump testdata import version

* fix(ext): support rename from rollout percentage to threshold

* fix(ext): ensure minimum version enforced as expected

* test(readonly): update suite with boolean flag assertions

* feat(ext): support implicit rank in flag state version 1.1

* chore(ext): correct typos in comments

* fix(test/cli): update assertion for import/export

* feat(validate): add support for state version 1.1

* chore(build): address comment fix suggestions

* fix(test/migration): use an import file valid for latest

* fix(test/migration): import using latest build not tip
  • Loading branch information
GeorgeMac committed Jul 7, 2023
1 parent caa2e0e commit af0149c
Show file tree
Hide file tree
Showing 23 changed files with 19,380 additions and 5,092 deletions.
2 changes: 1 addition & 1 deletion build/testing/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ Use "flipt [command] --help" for more information about a command.
expectedFliptYAML = `flags:
- key: zUFtS7D0UyMeueYu
name: UAoZRksg94r1iipa
type: VARIANT_FLAG_TYPE
description: description
enabled: true
variants:
Expand All @@ -194,7 +195,6 @@ Use "flipt [command] --help" for more information about a command.
- key: sDGD6NvfCRyaQUn3
rules:
- segment: 08UoVJ96LhZblPEx
rank: 1
distributions:
- variant: NGxfcVffpMhBz9n8
rollout: 100
Expand Down
4 changes: 2 additions & 2 deletions build/testing/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func importExport(ctx context.Context, _ *dagger.Client, base, flipt *dagger.Con
if namespace == "" {
namespace = "default"
// replace namespace in expected yaml
expected = strings.ReplaceAll(expected, "version: \"1.0\"\n", fmt.Sprintf("version: \"1.0\"\nnamespace: %s\n", namespace))
expected = strings.ReplaceAll(expected, "version: \"1.1\"\n", fmt.Sprintf("version: \"1.1\"\nnamespace: %s\n", namespace))
}

// use target flipt binary to invoke import
Expand All @@ -272,7 +272,7 @@ func importExport(ctx context.Context, _ *dagger.Client, base, flipt *dagger.Con

diff := cmp.Diff(expected, generated)
if diff != "" {
fmt.Println("Unexpected difference in exported output:")
fmt.Printf("Unexpected difference in %q exported output: \n", conf.name)
fmt.Println(diff)
return errors.New("exported yaml did not match")
}
Expand Down
8 changes: 4 additions & 4 deletions build/testing/integration/readonly/readonly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestReadOnly(t *testing.T) {
NamespaceKey: namespace,
})
require.NoError(t, err)
require.Len(t, flags.Flags, 51)
require.Len(t, flags.Flags, 52)

flag := flags.Flags[0]
assert.Equal(t, namespace, flag.NamespaceKey)
Expand All @@ -128,8 +128,8 @@ func TestReadOnly(t *testing.T) {
require.NoError(t, err)

if flags.NextPageToken == "" {
// ensure last page contains 1 entry
assert.Len(t, flags.Flags, 1)
// ensure last page contains 2 entries (boolean and disabled)
assert.Len(t, flags.Flags, 2)

found = append(found, flags.Flags...)

Expand All @@ -144,7 +144,7 @@ func TestReadOnly(t *testing.T) {
nextPage = flags.NextPageToken
}

require.Len(t, found, 51)
require.Len(t, found, 52)
})
})

Expand Down
Loading

0 comments on commit af0149c

Please sign in to comment.