chore: redhat cataloger error when sqlite not regsitered (#4150)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Keith Zantow
2025-08-21 14:55:47 +00:00
committed by GitHub
parent 26792fc12d
commit ca21ccf21d
7 changed files with 47 additions and 10 deletions
@@ -0,0 +1,22 @@
package sqlitetest
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/anchore/syft/syft/internal/fileresolver"
"github.com/anchore/syft/syft/pkg/cataloger/redhat"
)
func Test_noSQLiteDriverError(t *testing.T) {
// this test package does must not import the sqlite library
file := "../test-fixtures/Packages"
resolver, err := fileresolver.NewFromFile(file, file)
require.NoError(t, err)
cataloger := redhat.NewDBCataloger()
_, _, err = cataloger.Catalog(context.TODO(), resolver)
require.ErrorContains(t, err, "sqlite")
}