Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Oct 17, 2024
1 parent ff75ac0 commit 4e0c497
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions integrationtests/standard_mode_prerequisite_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ func testStandardModeWithPrerequisites(t *testing.T, manager *integrationTestMan
requirePrerequisitesEqual(t, expectedPrerequisites, gotPrerequisites)
})

t.Run("ignores client-side-only for prereq keys", func(t *testing.T) {
t.Run("environment ID", func(t *testing.T) {
t.Run("exposes prerequisite relationship even if prereq is hidden from clients", func(t *testing.T) {
t.Run("partially visible to environment ID", func(t *testing.T) {
api, err := newScopedApiHelper(manager.apiHelper)
require.NoError(t, err)
defer api.cleanup()

expectedPrerequisites, err := makeIgnoreEnvironmentIDOnlyPrereqs(api)
// One prereq is visible to env ID, the other is not. The top level flag
// is visible to env ID. We should see an eval result for the top level flag (with prereqs),
// and for the one prereq that is visible, but not for the other.
expectedPrerequisites, err := makePartiallyVisibleToEnvironmentIDPrerequisites(api)
require.NoError(t, err)

manager.startRelay(t, api.envVariables())
Expand All @@ -140,12 +143,15 @@ func testStandardModeWithPrerequisites(t *testing.T, manager *integrationTestMan
requirePrerequisitesEqual(t, expectedPrerequisites, gotPrerequisites)
})

t.Run("mobile key", func(t *testing.T) {
t.Run("partially visible to mobile key", func(t *testing.T) {
api, err := newScopedApiHelper(manager.apiHelper)
require.NoError(t, err)
defer api.cleanup()

expectedPrerequisites, err := makeIgnoreMobileKeyOnlyPrereqs(api)
// One prereq is visible to mobile key, the other is not. The top level flag
// is visible to mobile key. We should see an eval result for the top level flag (with prereqs),
// and for the one prereq that is visible, but not for the other.
expectedPrerequisites, err := makePartiallyVisibleToMobileKeyPrerequisites(api)
require.NoError(t, err)

manager.startRelay(t, api.envVariables())
Expand Down Expand Up @@ -262,7 +268,7 @@ func makeFailedPrerequisites(api *scopedApiHelper) (map[string][]string, error)
}, nil
}

func makeIgnoreEnvironmentIDOnlyPrereqs(api *scopedApiHelper) (map[string][]string, error) {
func makePartiallyVisibleToEnvironmentIDPrerequisites(api *scopedApiHelper) (map[string][]string, error) {
// flag -> prereq1, prereq2

if err := api.newFlag("prereq1").
Expand Down Expand Up @@ -297,7 +303,7 @@ func makeIgnoreEnvironmentIDOnlyPrereqs(api *scopedApiHelper) (map[string][]stri
}, nil
}

func makeIgnoreMobileKeyOnlyPrereqs(api *scopedApiHelper) (map[string][]string, error) {
func makePartiallyVisibleToMobileKeyPrerequisites(api *scopedApiHelper) (map[string][]string, error) {
// flag -> prereq1, prereq2

if err := api.newFlag("prereq1").
Expand Down

0 comments on commit 4e0c497

Please sign in to comment.