syft/syft/pkg/cataloger/githubactions/cataloger_test.go
Alex Goodman 1cfc4c7387
Normalize cataloger configuration patterns (#2365)
* normalize cataloger patterns

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* remove central reference for maven configurable

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2023-11-28 17:02:43 +00:00

51 lines
1.2 KiB
Go

package githubactions
import (
"testing"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
)
func TestCataloger_Globs(t *testing.T) {
tests := []struct {
name string
fixture string
cataloger pkg.Cataloger
expected []string
}{
{
name: "obtain all workflow and composite action files",
fixture: "test-fixtures/glob",
cataloger: NewActionUsageCataloger(),
expected: []string{
// composite actions
".github/actions/bootstrap/action.yaml",
".github/actions/unbootstrap/action.yml",
// workflows
".github/workflows/release.yml",
".github/workflows/validations.yaml",
},
},
{
name: "obtain all workflow files",
fixture: "test-fixtures/glob",
cataloger: NewWorkflowUsageCataloger(),
expected: []string{
// workflows
".github/workflows/release.yml",
".github/workflows/validations.yaml",
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
pkgtest.NewCatalogTester().
FromDirectory(t, test.fixture).
ExpectsResolverContentQueries(test.expected).
TestCataloger(t, test.cataloger)
})
}
}