github.com/metasources/buildx@v0.0.0-20230418141019-7aa1459cedea/test/integration/regression_apk_scanner_buffer_size_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 TestRegression212ApkBufferSize(t *testing.T) {
    11  	// This is a regression test for issue #212 (https://github.com/metasources/buildx/issues/212) in which the apk db could
    12  	// not be processed due to a scanner buffer that was too small
    13  	sbom, _ := catalogFixtureImage(t, "image-large-apk-data", source.SquashedScope, nil)
    14  
    15  	expectedPkgs := 58
    16  	actualPkgs := 0
    17  	for range sbom.Artifacts.PackageCatalog.Enumerate(pkg.ApkPkg) {
    18  		actualPkgs += 1
    19  	}
    20  
    21  	if actualPkgs != expectedPkgs {
    22  		t.Errorf("unexpected number of APK packages: %d != %d", expectedPkgs, actualPkgs)
    23  	}
    24  }