mirror of
https://github.com/anchore/syft.git
synced 2025-11-20 01:43:17 +01:00
* feat: add conaninfo.txt parser to detect conan packages in docker images Signed-off-by: Stefan Profanter <stefan.profanter@agile-robots.com> * fix: add NewConanInfoCataloger as a separate cataloger Signed-off-by: Stefan Profanter <stefan.profanter@agile-robots.com> --------- Signed-off-by: Stefan Profanter <stefan.profanter@agile-robots.com>
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package cpp
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
|
|
)
|
|
|
|
func TestCataloger_Globs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
fixture string
|
|
expected []string
|
|
}{
|
|
{
|
|
name: "obtain conan files",
|
|
fixture: "test-fixtures/glob-paths",
|
|
expected: []string{
|
|
"somewhere/src/conanfile.txt",
|
|
"somewhere/src/conan.lock",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pkgtest.NewCatalogTester().
|
|
FromDirectory(t, test.fixture).
|
|
ExpectsResolverContentQueries(test.expected).
|
|
TestCataloger(t, NewConanCataloger())
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestCatalogerInfo_Globs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
fixture string
|
|
expected []string
|
|
}{
|
|
{
|
|
name: "obtain conan files",
|
|
fixture: "test-fixtures/glob-paths",
|
|
expected: []string{
|
|
"somewhere/src/conaninfo.txt",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pkgtest.NewCatalogTester().
|
|
FromDirectory(t, test.fixture).
|
|
ExpectsResolverContentQueries(test.expected).
|
|
TestCataloger(t, NewConanInfoCataloger())
|
|
})
|
|
}
|
|
}
|