github.com/metasources/buildx@v0.0.0-20230418141019-7aa1459cedea/test/integration/sqlite_rpmdb_test.go (about)

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