Failing process layer test
Arch Linux uses a directory for tracking installed packages. The process layers function will only record the features from the final layer.
This commit is contained in:
parent
7f3aa2e932
commit
eec97e41f7
BIN
testdata/arch/arch.tar.gz
vendored
Normal file
BIN
testdata/arch/arch.tar.gz
vendored
Normal file
Binary file not shown.
BIN
testdata/arch/arch2.tar.gz
vendored
Normal file
BIN
testdata/arch/arch2.tar.gz
vendored
Normal file
Binary file not shown.
BIN
testdata/arch/arch3.tar.gz
vendored
Normal file
BIN
testdata/arch/arch3.tar.gz
vendored
Normal file
Binary file not shown.
BIN
testdata/arch/blank.tar.gz
vendored
Normal file
BIN
testdata/arch/blank.tar.gz
vendored
Normal file
Binary file not shown.
@ -510,6 +510,15 @@ func computeAncestryFeatures(ancestryLayers []database.LayerWithContent) ([]data
|
||||
// all detectable features removed is to pass in the file status.
|
||||
for vf, mapF := range currentFeatures {
|
||||
features[vf] = mapF
|
||||
/*
|
||||
// FIXME: Arch Linux installed packages are a list of directories
|
||||
if len(features[vf]) == 0 {
|
||||
features[vf] = make(map[string]database.NamespacedFeature)
|
||||
}
|
||||
for k, f := range mapF {
|
||||
features[vf][k] = f
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
"github.com/coreos/clair/pkg/strutil"
|
||||
|
||||
// Register the required detectors.
|
||||
_ "github.com/coreos/clair/ext/featurefmt/alpm"
|
||||
_ "github.com/coreos/clair/ext/featurefmt/dpkg"
|
||||
_ "github.com/coreos/clair/ext/featurefmt/rpm"
|
||||
_ "github.com/coreos/clair/ext/featurens/aptsources"
|
||||
@ -337,7 +338,7 @@ func TestProcessAncestryWithDistUpgrade(t *testing.T) {
|
||||
|
||||
nonUpgradedMap := map[database.Feature]struct{}{}
|
||||
for _, f := range nonUpgradedFeatures {
|
||||
f.VersionFormat = "dpkg"
|
||||
f.VersionFormat = dpkg.ParserName
|
||||
nonUpgradedMap[f] = struct{}{}
|
||||
}
|
||||
|
||||
@ -435,6 +436,36 @@ func TestProcessLayers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessArchLayers(t *testing.T) {
|
||||
_, f, _, _ := runtime.Caller(0)
|
||||
testDataPath := filepath.Join(filepath.Dir(f)) + "/testdata/arch/"
|
||||
|
||||
datastore := newMockDatastore()
|
||||
|
||||
// suppose there are multiple arch layers
|
||||
layers := []LayerRequest{
|
||||
{Hash: "blank", Path: testDataPath + "blank.tar.gz"},
|
||||
{Hash: "arch", Path: testDataPath + "arch.tar.gz"},
|
||||
{Hash: "arch2", Path: testDataPath + "arch2.tar.gz"},
|
||||
{Hash: "arch3", Path: testDataPath + "arch3.tar.gz"},
|
||||
}
|
||||
|
||||
Processors = database.Processors{
|
||||
Detectors: []string{"os-release"},
|
||||
Listers: []string{"alpm"},
|
||||
}
|
||||
|
||||
assert.Nil(t, ProcessAncestry(datastore, "Docker", "Mock", layers))
|
||||
assert.Len(t, datastore.ancestry["Mock"].Features, 6)
|
||||
|
||||
// check the namespaces are correct
|
||||
for _, f := range datastore.ancestry["Mock"].Features {
|
||||
if !assert.NotEqual(t, database.Namespace{}, f.Namespace) {
|
||||
assert.Fail(t, "Every feature should have a namespace attached")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestUpgradeClair checks if a clair is upgraded and certain ancestry's
|
||||
// features should not change. We assume that Clair should only upgrade
|
||||
func TestClairUpgrade(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user