-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supporting path mirror lookup with precedence during repo policy look…
…up (ee) (#1591) * add project prefix directory lookups when loading policies from repo [ee]
- Loading branch information
Showing
7 changed files
with
105 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package policy | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"log" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func init() { | ||
log.SetOutput(os.Stdout) | ||
log.SetFlags(log.Ldate | log.Ltime) | ||
} | ||
|
||
func TestGetPrefixesForPath(t *testing.T) { | ||
prefixes := GetPrefixesForPath("dev/vpc/subnets", "access.rego") | ||
assert.Equal(t, []string{"dev/vpc/subnets/access.rego", "dev/vpc/access.rego", "dev/access.rego"}, prefixes) | ||
log.Printf("%v", prefixes) | ||
} | ||
|
||
func TestGetPrefixesForPathAbsolute(t *testing.T) { | ||
prefixes := GetPrefixesForPath("/dev/vpc/subnets", "access.rego") | ||
assert.Equal(t, []string{"/dev/vpc/subnets/access.rego", "/dev/vpc/access.rego", "/dev/access.rego"}, prefixes) | ||
log.Printf("%v", prefixes) | ||
} |