Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into required-secret
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Nov 14, 2023
2 parents 7a8c756 + eb2ec3f commit d01791b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
23 changes: 8 additions & 15 deletions code/go/pkg/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package validator

import (
"errors"
"fmt"
"os"
"path"
Expand Down Expand Up @@ -255,28 +256,20 @@ func TestValidateFile(t *testing.T) {
},
}

filter := specerrors.NewFilter(&specerrors.ConfigFilter{
Errors: specerrors.Processors{
ExcludeChecks: []string{
// Allow to test unreleased features in "good" packages.
"PSR00001",

// TODO: Actually fix the references instead of ignoring the error.
"SVR00004",
},
},
})

for pkgName, test := range tests {
t.Run(pkgName, func(t *testing.T) {
pkgRootPath := filepath.Join("..", "..", "..", "..", "test", "packages", pkgName)
errPrefix := fmt.Sprintf("file \"%s/%s\" is invalid: ", pkgRootPath, test.invalidPkgFilePath)

errs := ValidateFromPath(pkgRootPath)
if verrs, ok := errs.(specerrors.ValidationErrors); ok {
result, err := filter.Run(verrs)
require.NoError(t, err)
errs = result.Processed
filterConfig, err := specerrors.LoadConfigFilter(os.DirFS(pkgRootPath))
if !errors.Is(err, os.ErrNotExist) {
filter := specerrors.NewFilter(filterConfig)
result, err := filter.Run(verrs)
require.NoError(t, err)
errs = result.Processed
}
}

if test.expectedErrContains == nil {
Expand Down
3 changes: 3 additions & 0 deletions test/packages/bad_dangling_object_ids/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
errors:
exclude_checks:
- SVR00004 # References in dashboards.
3 changes: 3 additions & 0 deletions test/packages/good_v3/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
errors:
exclude_checks:
- PSR00001 # Allow to use unreleased features in GA package.
3 changes: 3 additions & 0 deletions test/packages/kibana_legacy_visualizations/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
errors:
exclude_checks:
- SVR00004 # References in dashboards.

0 comments on commit d01791b

Please sign in to comment.