github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/test/integration/sqlite_rpmdb_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"testing"
     5  
     6  	_ "modernc.org/sqlite"
     7  
     8  	"github.com/anchore/syft/syft/pkg"
     9  	"github.com/anchore/syft/syft/source"
    10  )
    11  
    12  func TestSqliteRpm(t *testing.T) {
    13  	// This is a regression test for issue #469 (https://github.com/anchore/syft/issues/469). Recent RPM
    14  	// based distribution store package data in an sqlite database
    15  	sbom, _ := catalogFixtureImage(t, "image-sqlite-rpmdb", source.SquashedScope, nil)
    16  
    17  	expectedPkgs := 139
    18  	actualPkgs := 0
    19  	for range sbom.Artifacts.Packages.Enumerate(pkg.RpmPkg) {
    20  		actualPkgs += 1
    21  	}
    22  
    23  	if actualPkgs != expectedPkgs {
    24  		t.Errorf("unexpected number of RPM packages: %d != %d", expectedPkgs, actualPkgs)
    25  	}
    26  }