Skip to content

Commit

Permalink
Alter the code to reflect the changes in library-go
Browse files Browse the repository at this point in the history
  • Loading branch information
ingvagabund committed Jan 5, 2023
1 parent 9e6fd35 commit 57bbb53
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/test/assets_test.go
Expand Up @@ -18,8 +18,13 @@ func TestYamlCorrectness(t *testing.T) {

func readAllYaml(path string, t *testing.T) {
// TODO: validate also recovery manifest but they take different template and are covered by unit tests
manifests, err := assets.New(path, render.TemplateData{}, func(info os.FileInfo) bool {
return assets.OnlyYaml(info) && !strings.HasPrefix(info.Name(), "recovery-") &&
manifests, err := assets.New(path, render.TemplateData{}, func(path string, info os.FileInfo) (bool, error) {
is, err := assets.OnlyYaml(path, info)
if err != nil {
return is, err
}

return is && !strings.HasPrefix(info.Name(), "recovery-") &&
// the dashboard is a ConfigMap yaml but it has an embedded json in data that causes the reader to fail.
!strings.HasSuffix(info.Name(), "api_performance_dashboard.yaml") &&
// there is an alert message containing $labels strings that cause the reader to fail.
Expand All @@ -29,7 +34,7 @@ func readAllYaml(path string, t *testing.T) {
// there is an alert message containing $labels strings that cause the reader to fail.
!strings.HasSuffix(info.Name(), "podsecurity-violations.yaml") &&
// the kas's pod manifest contains go template values and fails compilation
!strings.HasSuffix(info.Name(), "pod.yaml")
!strings.HasSuffix(info.Name(), "pod.yaml"), nil

})
if err != nil {
Expand Down

0 comments on commit 57bbb53

Please sign in to comment.