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

     1  package integration
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/anchore/syft/syft/source"
     7  )
     8  
     9  func Test_AllLayersIncludesSquashed(t *testing.T) {
    10  	// This is a verification test for issue #894 (https://github.com/anchore/syft/issues/894)
    11  	allLayers, _ := catalogFixtureImage(t, "image-suse-all-layers", source.AllLayersScope, nil)
    12  	squashed, _ := catalogFixtureImage(t, "image-suse-all-layers", source.SquashedScope, nil)
    13  
    14  	lenAllLayers := len(allLayers.Artifacts.Packages.Sorted())
    15  	lenSquashed := len(squashed.Artifacts.Packages.Sorted())
    16  
    17  	if lenAllLayers < lenSquashed {
    18  		t.Errorf("squashed has more packages than all-layers: %d > %d", lenSquashed, lenAllLayers)
    19  	}
    20  }