commit
d1e9a21e0e
@ -50,7 +50,7 @@ type ClairAPI struct {
|
|||||||
type AddLayoutRequestAPI struct {
|
type AddLayoutRequestAPI struct {
|
||||||
ID string `json:"ID"`
|
ID string `json:"ID"`
|
||||||
Path string `json:"Path"`
|
Path string `json:"Path"`
|
||||||
ParantID string `json:"ParantID"`
|
ParentID string `json:"ParentID"`
|
||||||
ImageFormat string `json:"ImageFormat"`
|
ImageFormat string `json:"ImageFormat"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ func CheckPriority(priority string) (result string, err error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if match {
|
if match {
|
||||||
result = strings.ToUpper(string(priority[0])) + strings.ToLower(priority[1:len(priority)])
|
result = strings.ToUpper(string(priority[0])) + strings.ToLower(priority[1:])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return "", errors.New("Unknown priority " + priority)
|
return "", errors.New("Unknown priority " + priority)
|
||||||
|
@ -83,7 +83,7 @@ func TestRaceAffects(t *testing.T) {
|
|||||||
Name: uuid.New(),
|
Name: uuid.New(),
|
||||||
Namespace: feature.Namespace,
|
Namespace: feature.Namespace,
|
||||||
FixedIn: []database.FeatureVersion{
|
FixedIn: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: feature,
|
Feature: feature,
|
||||||
Version: types.NewVersionUnsafe(strconv.Itoa(version)),
|
Version: types.NewVersionUnsafe(strconv.Itoa(version)),
|
||||||
},
|
},
|
||||||
|
@ -55,25 +55,25 @@ func TestInsertFeature(t *testing.T) {
|
|||||||
|
|
||||||
// Insert invalid FeatureVersion.
|
// Insert invalid FeatureVersion.
|
||||||
for _, invalidFeatureVersion := range []database.FeatureVersion{
|
for _, invalidFeatureVersion := range []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{},
|
Feature: database.Feature{},
|
||||||
Version: types.NewVersionUnsafe("1.0"),
|
Version: types.NewVersionUnsafe("1.0"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{},
|
Namespace: database.Namespace{},
|
||||||
Name: "TestInsertFeature2",
|
Name: "TestInsertFeature2",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("1.0"),
|
Version: types.NewVersionUnsafe("1.0"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "TestInsertFeatureNamespace2"},
|
Namespace: database.Namespace{Name: "TestInsertFeatureNamespace2"},
|
||||||
Name: "TestInsertFeature2",
|
Name: "TestInsertFeature2",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe(""),
|
Version: types.NewVersionUnsafe(""),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "TestInsertFeatureNamespace2"},
|
Namespace: database.Namespace{Name: "TestInsertFeatureNamespace2"},
|
||||||
Name: "TestInsertFeature2",
|
Name: "TestInsertFeature2",
|
||||||
|
@ -124,9 +124,9 @@ func TestInsertLayer(t *testing.T) {
|
|||||||
|
|
||||||
func testInsertLayerInvalid(t *testing.T, datastore database.Datastore) {
|
func testInsertLayerInvalid(t *testing.T, datastore database.Datastore) {
|
||||||
invalidLayers := []database.Layer{
|
invalidLayers := []database.Layer{
|
||||||
database.Layer{},
|
{},
|
||||||
database.Layer{Name: "layer0", Parent: &database.Layer{}},
|
{Name: "layer0", Parent: &database.Layer{}},
|
||||||
database.Layer{Name: "layer0", Parent: &database.Layer{Name: "UnknownLayer"}},
|
{Name: "layer0", Parent: &database.Layer{Name: "UnknownLayer"}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, invalidLayer := range invalidLayers {
|
for _, invalidLayer := range invalidLayers {
|
||||||
@ -180,23 +180,23 @@ func testInsertLayerTree(t *testing.T, datastore database.Datastore) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
layers := []database.Layer{
|
layers := []database.Layer{
|
||||||
database.Layer{
|
{
|
||||||
Name: "TestInsertLayer1",
|
Name: "TestInsertLayer1",
|
||||||
},
|
},
|
||||||
database.Layer{
|
{
|
||||||
Name: "TestInsertLayer2",
|
Name: "TestInsertLayer2",
|
||||||
Parent: &database.Layer{Name: "TestInsertLayer1"},
|
Parent: &database.Layer{Name: "TestInsertLayer1"},
|
||||||
Namespace: &database.Namespace{Name: "TestInsertLayerNamespace1"},
|
Namespace: &database.Namespace{Name: "TestInsertLayerNamespace1"},
|
||||||
},
|
},
|
||||||
// This layer changes the namespace and adds Features.
|
// This layer changes the namespace and adds Features.
|
||||||
database.Layer{
|
{
|
||||||
Name: "TestInsertLayer3",
|
Name: "TestInsertLayer3",
|
||||||
Parent: &database.Layer{Name: "TestInsertLayer2"},
|
Parent: &database.Layer{Name: "TestInsertLayer2"},
|
||||||
Namespace: &database.Namespace{Name: "TestInsertLayerNamespace2"},
|
Namespace: &database.Namespace{Name: "TestInsertLayerNamespace2"},
|
||||||
Features: []database.FeatureVersion{f1, f2, f3},
|
Features: []database.FeatureVersion{f1, f2, f3},
|
||||||
},
|
},
|
||||||
// This layer covers the case where the last layer doesn't provide any new Feature.
|
// This layer covers the case where the last layer doesn't provide any new Feature.
|
||||||
database.Layer{
|
{
|
||||||
Name: "TestInsertLayer4a",
|
Name: "TestInsertLayer4a",
|
||||||
Parent: &database.Layer{Name: "TestInsertLayer3"},
|
Parent: &database.Layer{Name: "TestInsertLayer3"},
|
||||||
Features: []database.FeatureVersion{f1, f2, f3},
|
Features: []database.FeatureVersion{f1, f2, f3},
|
||||||
@ -204,7 +204,7 @@ func testInsertLayerTree(t *testing.T, datastore database.Datastore) {
|
|||||||
// This layer covers the case where the last layer provides Features.
|
// This layer covers the case where the last layer provides Features.
|
||||||
// It also modifies the Namespace ("upgrade") but keeps some Features not upgraded, their
|
// It also modifies the Namespace ("upgrade") but keeps some Features not upgraded, their
|
||||||
// Namespaces should then remain unchanged.
|
// Namespaces should then remain unchanged.
|
||||||
database.Layer{
|
{
|
||||||
Name: "TestInsertLayer4b",
|
Name: "TestInsertLayer4b",
|
||||||
Parent: &database.Layer{Name: "TestInsertLayer3"},
|
Parent: &database.Layer{Name: "TestInsertLayer3"},
|
||||||
Namespace: &database.Namespace{Name: "TestInsertLayerNamespace3"},
|
Namespace: &database.Namespace{Name: "TestInsertLayerNamespace3"},
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
package pgsql
|
package pgsql
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/coreos/clair/database"
|
"github.com/coreos/clair/database"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -36,7 +36,7 @@ func TestNotification(t *testing.T) {
|
|||||||
l1 := database.Layer{
|
l1 := database.Layer{
|
||||||
Name: "TestNotificationLayer1",
|
Name: "TestNotificationLayer1",
|
||||||
Features: []database.FeatureVersion{
|
Features: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f1,
|
Feature: f1,
|
||||||
Version: types.NewVersionUnsafe("0.1"),
|
Version: types.NewVersionUnsafe("0.1"),
|
||||||
},
|
},
|
||||||
@ -46,7 +46,7 @@ func TestNotification(t *testing.T) {
|
|||||||
l2 := database.Layer{
|
l2 := database.Layer{
|
||||||
Name: "TestNotificationLayer2",
|
Name: "TestNotificationLayer2",
|
||||||
Features: []database.FeatureVersion{
|
Features: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f1,
|
Feature: f1,
|
||||||
Version: types.NewVersionUnsafe("0.2"),
|
Version: types.NewVersionUnsafe("0.2"),
|
||||||
},
|
},
|
||||||
@ -56,7 +56,7 @@ func TestNotification(t *testing.T) {
|
|||||||
l3 := database.Layer{
|
l3 := database.Layer{
|
||||||
Name: "TestNotificationLayer3",
|
Name: "TestNotificationLayer3",
|
||||||
Features: []database.FeatureVersion{
|
Features: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f1,
|
Feature: f1,
|
||||||
Version: types.NewVersionUnsafe("0.3"),
|
Version: types.NewVersionUnsafe("0.3"),
|
||||||
},
|
},
|
||||||
@ -66,7 +66,7 @@ func TestNotification(t *testing.T) {
|
|||||||
l4 := database.Layer{
|
l4 := database.Layer{
|
||||||
Name: "TestNotificationLayer4",
|
Name: "TestNotificationLayer4",
|
||||||
Features: []database.FeatureVersion{
|
Features: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f2,
|
Feature: f2,
|
||||||
Version: types.NewVersionUnsafe("0.1"),
|
Version: types.NewVersionUnsafe("0.1"),
|
||||||
},
|
},
|
||||||
@ -88,7 +88,7 @@ func TestNotification(t *testing.T) {
|
|||||||
Link: "TestNotificationLink1",
|
Link: "TestNotificationLink1",
|
||||||
Severity: "Unknown",
|
Severity: "Unknown",
|
||||||
FixedIn: []database.FeatureVersion{
|
FixedIn: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f1,
|
Feature: f1,
|
||||||
Version: types.NewVersionUnsafe("1.0"),
|
Version: types.NewVersionUnsafe("1.0"),
|
||||||
},
|
},
|
||||||
@ -148,11 +148,11 @@ func TestNotification(t *testing.T) {
|
|||||||
v1b := v1
|
v1b := v1
|
||||||
v1b.Severity = types.High
|
v1b.Severity = types.High
|
||||||
v1b.FixedIn = []database.FeatureVersion{
|
v1b.FixedIn = []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f1,
|
Feature: f1,
|
||||||
Version: types.MinVersion,
|
Version: types.MinVersion,
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: f2,
|
Feature: f2,
|
||||||
Version: types.MaxVersion,
|
Version: types.MaxVersion,
|
||||||
},
|
},
|
||||||
|
@ -465,7 +465,7 @@ func (pgSQL *pgSQL) DeleteVulnerabilityFix(vulnerabilityNamespace, vulnerability
|
|||||||
Name: vulnerabilityNamespace,
|
Name: vulnerabilityNamespace,
|
||||||
},
|
},
|
||||||
FixedIn: []database.FeatureVersion{
|
FixedIn: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Name: featureName,
|
Name: featureName,
|
||||||
Namespace: database.Namespace{
|
Namespace: database.Namespace{
|
||||||
|
@ -44,11 +44,11 @@ func TestFindVulnerability(t *testing.T) {
|
|||||||
Severity: types.High,
|
Severity: types.High,
|
||||||
Namespace: database.Namespace{Name: "debian:7"},
|
Namespace: database.Namespace{Name: "debian:7"},
|
||||||
FixedIn: []database.FeatureVersion{
|
FixedIn: []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "openssl"},
|
Feature: database.Feature{Name: "openssl"},
|
||||||
Version: types.NewVersionUnsafe("2.0"),
|
Version: types.NewVersionUnsafe("2.0"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "libssl"},
|
Feature: database.Feature{Name: "libssl"},
|
||||||
Version: types.NewVersionUnsafe("1.9-abc"),
|
Version: types.NewVersionUnsafe("1.9-abc"),
|
||||||
},
|
},
|
||||||
@ -161,30 +161,30 @@ func TestInsertVulnerability(t *testing.T) {
|
|||||||
|
|
||||||
// Insert invalid vulnerabilities.
|
// Insert invalid vulnerabilities.
|
||||||
for _, vulnerability := range []database.Vulnerability{
|
for _, vulnerability := range []database.Vulnerability{
|
||||||
database.Vulnerability{
|
{
|
||||||
Name: "",
|
Name: "",
|
||||||
Namespace: n1,
|
Namespace: n1,
|
||||||
FixedIn: []database.FeatureVersion{f1},
|
FixedIn: []database.FeatureVersion{f1},
|
||||||
Severity: types.Unknown,
|
Severity: types.Unknown,
|
||||||
},
|
},
|
||||||
database.Vulnerability{
|
{
|
||||||
Name: "TestInsertVulnerability0",
|
Name: "TestInsertVulnerability0",
|
||||||
Namespace: database.Namespace{},
|
Namespace: database.Namespace{},
|
||||||
FixedIn: []database.FeatureVersion{f1},
|
FixedIn: []database.FeatureVersion{f1},
|
||||||
Severity: types.Unknown,
|
Severity: types.Unknown,
|
||||||
},
|
},
|
||||||
database.Vulnerability{
|
{
|
||||||
Name: "TestInsertVulnerability0-",
|
Name: "TestInsertVulnerability0-",
|
||||||
Namespace: database.Namespace{},
|
Namespace: database.Namespace{},
|
||||||
FixedIn: []database.FeatureVersion{f1},
|
FixedIn: []database.FeatureVersion{f1},
|
||||||
},
|
},
|
||||||
database.Vulnerability{
|
{
|
||||||
Name: "TestInsertVulnerability0",
|
Name: "TestInsertVulnerability0",
|
||||||
Namespace: n1,
|
Namespace: n1,
|
||||||
FixedIn: []database.FeatureVersion{f1},
|
FixedIn: []database.FeatureVersion{f1},
|
||||||
Severity: types.Priority(""),
|
Severity: types.Priority(""),
|
||||||
},
|
},
|
||||||
database.Vulnerability{
|
{
|
||||||
Name: "TestInsertVulnerability0",
|
Name: "TestInsertVulnerability0",
|
||||||
Namespace: n1,
|
Namespace: n1,
|
||||||
FixedIn: []database.FeatureVersion{f2},
|
FixedIn: []database.FeatureVersion{f2},
|
||||||
|
@ -39,14 +39,14 @@ func TestDebianParser(t *testing.T) {
|
|||||||
assert.Equal(t, "This vulnerability is not very dangerous.", vulnerability.Description)
|
assert.Equal(t, "This vulnerability is not very dangerous.", vulnerability.Description)
|
||||||
|
|
||||||
expectedFeatureVersions := []database.FeatureVersion{
|
expectedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "debian:8"},
|
Namespace: database.Namespace{Name: "debian:8"},
|
||||||
Name: "aptdaemon",
|
Name: "aptdaemon",
|
||||||
},
|
},
|
||||||
Version: types.MaxVersion,
|
Version: types.MaxVersion,
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "debian:unstable"},
|
Namespace: database.Namespace{Name: "debian:unstable"},
|
||||||
|
|
||||||
@ -65,21 +65,21 @@ func TestDebianParser(t *testing.T) {
|
|||||||
assert.Equal(t, "But this one is very dangerous.", vulnerability.Description)
|
assert.Equal(t, "But this one is very dangerous.", vulnerability.Description)
|
||||||
|
|
||||||
expectedFeatureVersions := []database.FeatureVersion{
|
expectedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "debian:8"},
|
Namespace: database.Namespace{Name: "debian:8"},
|
||||||
Name: "aptdaemon",
|
Name: "aptdaemon",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("0.7.0"),
|
Version: types.NewVersionUnsafe("0.7.0"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "debian:unstable"},
|
Namespace: database.Namespace{Name: "debian:unstable"},
|
||||||
Name: "aptdaemon",
|
Name: "aptdaemon",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("0.7.0"),
|
Version: types.NewVersionUnsafe("0.7.0"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "debian:8"},
|
Namespace: database.Namespace{Name: "debian:8"},
|
||||||
Name: "asterisk",
|
Name: "asterisk",
|
||||||
@ -97,7 +97,7 @@ func TestDebianParser(t *testing.T) {
|
|||||||
assert.Equal(t, "Un-affected packages.", vulnerability.Description)
|
assert.Equal(t, "Un-affected packages.", vulnerability.Description)
|
||||||
|
|
||||||
expectedFeatureVersions := []database.FeatureVersion{
|
expectedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "debian:8"},
|
Namespace: database.Namespace{Name: "debian:8"},
|
||||||
Name: "asterisk",
|
Name: "asterisk",
|
||||||
|
@ -39,21 +39,21 @@ func TestRHELParser(t *testing.T) {
|
|||||||
assert.Equal(t, `Xerces-C is a validating XML parser written in a portable subset of C++. A flaw was found in the way the Xerces-C XML parser processed certain XML documents. A remote attacker could provide specially crafted XML input that, when parsed by an application using Xerces-C, would cause that application to crash.`, vulnerabilities[0].Description)
|
assert.Equal(t, `Xerces-C is a validating XML parser written in a portable subset of C++. A flaw was found in the way the Xerces-C XML parser processed certain XML documents. A remote attacker could provide specially crafted XML input that, when parsed by an application using Xerces-C, would cause that application to crash.`, vulnerabilities[0].Description)
|
||||||
|
|
||||||
expectedFeatureVersions := []database.FeatureVersion{
|
expectedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "centos:7"},
|
Namespace: database.Namespace{Name: "centos:7"},
|
||||||
Name: "xerces-c",
|
Name: "xerces-c",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("3.1.1-7.el7_1"),
|
Version: types.NewVersionUnsafe("3.1.1-7.el7_1"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "centos:7"},
|
Namespace: database.Namespace{Name: "centos:7"},
|
||||||
Name: "xerces-c-devel",
|
Name: "xerces-c-devel",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("3.1.1-7.el7_1"),
|
Version: types.NewVersionUnsafe("3.1.1-7.el7_1"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "centos:7"},
|
Namespace: database.Namespace{Name: "centos:7"},
|
||||||
Name: "xerces-c-doc",
|
Name: "xerces-c-doc",
|
||||||
@ -77,14 +77,14 @@ func TestRHELParser(t *testing.T) {
|
|||||||
assert.Equal(t, `Mozilla Firefox is an open source web browser. XULRunner provides the XUL Runtime environment for Mozilla Firefox. Several flaws were found in the processing of malformed web content. A web page containing malicious content could cause Firefox to crash or, potentially, execute arbitrary code with the privileges of the user running Firefox.`, vulnerabilities[0].Description)
|
assert.Equal(t, `Mozilla Firefox is an open source web browser. XULRunner provides the XUL Runtime environment for Mozilla Firefox. Several flaws were found in the processing of malformed web content. A web page containing malicious content could cause Firefox to crash or, potentially, execute arbitrary code with the privileges of the user running Firefox.`, vulnerabilities[0].Description)
|
||||||
|
|
||||||
expectedFeatureVersions := []database.FeatureVersion{
|
expectedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "centos:6"},
|
Namespace: database.Namespace{Name: "centos:6"},
|
||||||
Name: "firefox",
|
Name: "firefox",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("38.1.0-1.el6_6"),
|
Version: types.NewVersionUnsafe("38.1.0-1.el6_6"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "centos:7"},
|
Namespace: database.Namespace{Name: "centos:7"},
|
||||||
Name: "firefox",
|
Name: "firefox",
|
||||||
|
@ -43,30 +43,30 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
ubuntuIgnoredReleases = map[string]struct{}{
|
ubuntuIgnoredReleases = map[string]struct{}{
|
||||||
"upstream": struct{}{},
|
"upstream": {},
|
||||||
"devel": struct{}{},
|
"devel": {},
|
||||||
|
|
||||||
"dapper": struct{}{},
|
"dapper": {},
|
||||||
"edgy": struct{}{},
|
"edgy": {},
|
||||||
"feisty": struct{}{},
|
"feisty": {},
|
||||||
"gutsy": struct{}{},
|
"gutsy": {},
|
||||||
"hardy": struct{}{},
|
"hardy": {},
|
||||||
"intrepid": struct{}{},
|
"intrepid": {},
|
||||||
"jaunty": struct{}{},
|
"jaunty": {},
|
||||||
"karmic": struct{}{},
|
"karmic": {},
|
||||||
"lucid": struct{}{},
|
"lucid": {},
|
||||||
"maverick": struct{}{},
|
"maverick": {},
|
||||||
"natty": struct{}{},
|
"natty": {},
|
||||||
"oneiric": struct{}{},
|
"oneiric": {},
|
||||||
"saucy": struct{}{},
|
"saucy": {},
|
||||||
|
|
||||||
"vivid/ubuntu-core": struct{}{},
|
"vivid/ubuntu-core": {},
|
||||||
"vivid/stable-phone-overlay": struct{}{},
|
"vivid/stable-phone-overlay": {},
|
||||||
|
|
||||||
// Syntax error
|
// Syntax error
|
||||||
"Patches": struct{}{},
|
"Patches": {},
|
||||||
// Product
|
// Product
|
||||||
"product": struct{}{},
|
"product": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
affectsCaptureRegexp = regexp.MustCompile(`(?P<release>.*)_(?P<package>.*): (?P<status>[^\s]*)( \(+(?P<note>[^()]*)\)+)?`)
|
affectsCaptureRegexp = regexp.MustCompile(`(?P<release>.*)_(?P<package>.*): (?P<status>[^\s]*)( \(+(?P<note>[^()]*)\)+)?`)
|
||||||
|
@ -43,21 +43,21 @@ func TestUbuntuParser(t *testing.T) {
|
|||||||
assert.True(t, hasUnkownRelease)
|
assert.True(t, hasUnkownRelease)
|
||||||
|
|
||||||
expectedFeatureVersions := []database.FeatureVersion{
|
expectedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "ubuntu:14.04"},
|
Namespace: database.Namespace{Name: "ubuntu:14.04"},
|
||||||
Name: "libmspack",
|
Name: "libmspack",
|
||||||
},
|
},
|
||||||
Version: types.MaxVersion,
|
Version: types.MaxVersion,
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "ubuntu:15.04"},
|
Namespace: database.Namespace{Name: "ubuntu:15.04"},
|
||||||
Name: "libmspack",
|
Name: "libmspack",
|
||||||
},
|
},
|
||||||
Version: types.NewVersionUnsafe("0.4-3"),
|
Version: types.NewVersionUnsafe("0.4-3"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{
|
Feature: database.Feature{
|
||||||
Namespace: database.Namespace{Name: "ubuntu:15.10"},
|
Namespace: database.Namespace{Name: "ubuntu:15.10"},
|
||||||
Name: "libmspack-anotherpkg",
|
Name: "libmspack-anotherpkg",
|
||||||
|
@ -24,18 +24,18 @@ import (
|
|||||||
|
|
||||||
var dpkgPackagesTests = []feature.FeatureVersionTest{
|
var dpkgPackagesTests = []feature.FeatureVersionTest{
|
||||||
// Test an Ubuntu dpkg status file
|
// Test an Ubuntu dpkg status file
|
||||||
feature.FeatureVersionTest{
|
{
|
||||||
FeatureVersions: []database.FeatureVersion{
|
FeatureVersions: []database.FeatureVersion{
|
||||||
// Two packages from this source are installed, it should only appear one time
|
// Two packages from this source are installed, it should only appear one time
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "pam"},
|
Feature: database.Feature{Name: "pam"},
|
||||||
Version: types.NewVersionUnsafe("1.1.8-3.1ubuntu3"),
|
Version: types.NewVersionUnsafe("1.1.8-3.1ubuntu3"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "makedev"}, // The source name and the package name are equals
|
Feature: database.Feature{Name: "makedev"}, // The source name and the package name are equals
|
||||||
Version: types.NewVersionUnsafe("2.3.1-93ubuntu1"), // The version comes from the "Version:" line
|
Version: types.NewVersionUnsafe("2.3.1-93ubuntu1"), // The version comes from the "Version:" line
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "gcc-5"},
|
Feature: database.Feature{Name: "gcc-5"},
|
||||||
Version: types.NewVersionUnsafe("5.1.1-12ubuntu1"), // The version comes from the "Source:" line
|
Version: types.NewVersionUnsafe("5.1.1-12ubuntu1"), // The version comes from the "Source:" line
|
||||||
},
|
},
|
||||||
|
@ -25,15 +25,15 @@ import (
|
|||||||
var rpmPackagesTests = []feature.FeatureVersionTest{
|
var rpmPackagesTests = []feature.FeatureVersionTest{
|
||||||
// Test a CentOS 7 RPM database
|
// Test a CentOS 7 RPM database
|
||||||
// Memo: Use the following command on a RPM-based system to shrink a database: rpm -qa --qf "%{NAME}\n" |tail -n +3| xargs rpm -e --justdb
|
// Memo: Use the following command on a RPM-based system to shrink a database: rpm -qa --qf "%{NAME}\n" |tail -n +3| xargs rpm -e --justdb
|
||||||
feature.FeatureVersionTest{
|
{
|
||||||
FeatureVersions: []database.FeatureVersion{
|
FeatureVersions: []database.FeatureVersion{
|
||||||
// Two packages from this source are installed, it should only appear once
|
// Two packages from this source are installed, it should only appear once
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "centos-release"},
|
Feature: database.Feature{Name: "centos-release"},
|
||||||
Version: types.NewVersionUnsafe("7-1.1503.el7.centos.2.8"),
|
Version: types.NewVersionUnsafe("7-1.1503.el7.centos.2.8"),
|
||||||
},
|
},
|
||||||
// Two packages from this source are installed, it should only appear once
|
// Two packages from this source are installed, it should only appear once
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "filesystem"},
|
Feature: database.Feature{Name: "filesystem"},
|
||||||
Version: types.NewVersionUnsafe("3.2-18.el7"),
|
Version: types.NewVersionUnsafe("3.2-18.el7"),
|
||||||
},
|
},
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var aptSourcesOSTests = []namespace.NamespaceTest{
|
var aptSourcesOSTests = []namespace.NamespaceTest{
|
||||||
namespace.NamespaceTest{
|
{
|
||||||
ExpectedNamespace: database.Namespace{Name: "debian:unstable"},
|
ExpectedNamespace: database.Namespace{Name: "debian:unstable"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/os-release": []byte(
|
"etc/os-release": []byte(
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var lsbReleaseOSTests = []namespace.NamespaceTest{
|
var lsbReleaseOSTests = []namespace.NamespaceTest{
|
||||||
namespace.NamespaceTest{
|
{
|
||||||
ExpectedNamespace: database.Namespace{Name: "ubuntu:12.04"},
|
ExpectedNamespace: database.Namespace{Name: "ubuntu:12.04"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/lsb-release": []byte(
|
"etc/lsb-release": []byte(
|
||||||
@ -32,7 +32,7 @@ DISTRIB_CODENAME=precise
|
|||||||
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"`),
|
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
namespace.NamespaceTest{ // We don't care about the minor version of Debian
|
{ // We don't care about the minor version of Debian
|
||||||
ExpectedNamespace: database.Namespace{Name: "debian:7"},
|
ExpectedNamespace: database.Namespace{Name: "debian:7"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/lsb-release": []byte(
|
"etc/lsb-release": []byte(
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var osReleaseOSTests = []namespace.NamespaceTest{
|
var osReleaseOSTests = []namespace.NamespaceTest{
|
||||||
namespace.NamespaceTest{
|
{
|
||||||
ExpectedNamespace: database.Namespace{Name: "debian:8"},
|
ExpectedNamespace: database.Namespace{Name: "debian:8"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/os-release": []byte(
|
"etc/os-release": []byte(
|
||||||
@ -36,7 +36,7 @@ SUPPORT_URL="http://www.debian.org/support/"
|
|||||||
BUG_REPORT_URL="https://bugs.debian.org/"`),
|
BUG_REPORT_URL="https://bugs.debian.org/"`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
namespace.NamespaceTest{
|
{
|
||||||
ExpectedNamespace: database.Namespace{Name: "ubuntu:15.10"},
|
ExpectedNamespace: database.Namespace{Name: "ubuntu:15.10"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/os-release": []byte(
|
"etc/os-release": []byte(
|
||||||
@ -51,7 +51,7 @@ SUPPORT_URL="http://help.ubuntu.com/"
|
|||||||
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"`),
|
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
namespace.NamespaceTest{ // Doesn't have quotes around VERSION_ID
|
{ // Doesn't have quotes around VERSION_ID
|
||||||
ExpectedNamespace: database.Namespace{Name: "fedora:20"},
|
ExpectedNamespace: database.Namespace{Name: "fedora:20"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/os-release": []byte(
|
"etc/os-release": []byte(
|
||||||
|
@ -22,13 +22,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var redhatReleaseTests = []namespace.NamespaceTest{
|
var redhatReleaseTests = []namespace.NamespaceTest{
|
||||||
namespace.NamespaceTest{
|
{
|
||||||
ExpectedNamespace: database.Namespace{Name: "centos:6"},
|
ExpectedNamespace: database.Namespace{Name: "centos:6"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/centos-release": []byte(`CentOS release 6.6 (Final)`),
|
"etc/centos-release": []byte(`CentOS release 6.6 (Final)`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
namespace.NamespaceTest{
|
{
|
||||||
ExpectedNamespace: database.Namespace{Name: "centos:7"},
|
ExpectedNamespace: database.Namespace{Name: "centos:7"},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"etc/system-release": []byte(`CentOS Linux release 7.1.1503 (Core)`),
|
"etc/system-release": []byte(`CentOS Linux release 7.1.1503 (Core)`),
|
||||||
|
@ -63,35 +63,35 @@ func TestProcessWithDistUpgrade(t *testing.T) {
|
|||||||
|
|
||||||
// These FeatureVersions haven't been upgraded.
|
// These FeatureVersions haven't been upgraded.
|
||||||
nonUpgradedFeatureVersions := []database.FeatureVersion{
|
nonUpgradedFeatureVersions := []database.FeatureVersion{
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "libtext-wrapi18n-perl"},
|
Feature: database.Feature{Name: "libtext-wrapi18n-perl"},
|
||||||
Version: types.NewVersionUnsafe("0.06-7"),
|
Version: types.NewVersionUnsafe("0.06-7"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "libtext-charwidth-perl"},
|
Feature: database.Feature{Name: "libtext-charwidth-perl"},
|
||||||
Version: types.NewVersionUnsafe("0.04-7"),
|
Version: types.NewVersionUnsafe("0.04-7"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "libtext-iconv-perl"},
|
Feature: database.Feature{Name: "libtext-iconv-perl"},
|
||||||
Version: types.NewVersionUnsafe("1.7-5"),
|
Version: types.NewVersionUnsafe("1.7-5"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "mawk"},
|
Feature: database.Feature{Name: "mawk"},
|
||||||
Version: types.NewVersionUnsafe("1.3.3-17"),
|
Version: types.NewVersionUnsafe("1.3.3-17"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "insserv"},
|
Feature: database.Feature{Name: "insserv"},
|
||||||
Version: types.NewVersionUnsafe("1.14.0-5"),
|
Version: types.NewVersionUnsafe("1.14.0-5"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "db"},
|
Feature: database.Feature{Name: "db"},
|
||||||
Version: types.NewVersionUnsafe("5.1.29-5"),
|
Version: types.NewVersionUnsafe("5.1.29-5"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "ustr"},
|
Feature: database.Feature{Name: "ustr"},
|
||||||
Version: types.NewVersionUnsafe("1.0.4-3"),
|
Version: types.NewVersionUnsafe("1.0.4-3"),
|
||||||
},
|
},
|
||||||
database.FeatureVersion{
|
{
|
||||||
Feature: database.Feature{Name: "xz-utils"},
|
Feature: database.Feature{Name: "xz-utils"},
|
||||||
Version: types.NewVersionUnsafe("5.1.1alpha+20120614-2"),
|
Version: types.NewVersionUnsafe("5.1.1alpha+20120614-2"),
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user