feat(amazon): support Amazon Linux 2 Extra Repository (#1510)

* feat(amazon): support Amazon Linux 2 Extra Repository

* feat(amazon): set Amazon Linux EOL

* feat(oracle): set Oracle Linux EOL
This commit is contained in:
MaineK00n
2022-08-04 17:52:42 +09:00
committed by GitHub
parent f1c78e42a2
commit ca3f6b1dbf
8 changed files with 386 additions and 73 deletions

View File

@@ -199,11 +199,12 @@ func TestDefpacksToPackStatuses(t *testing.T) {
func TestIsOvalDefAffected(t *testing.T) {
type in struct {
def ovalmodels.Definition
req request
family string
kernel models.Kernel
mods []string
def ovalmodels.Definition
req request
family string
release string
kernel models.Kernel
mods []string
}
var tests = []struct {
in in
@@ -1856,10 +1857,63 @@ func TestIsOvalDefAffected(t *testing.T) {
wantErr: false,
fixedIn: "",
},
// amazon linux 2 repository
{
in: in{
family: constant.Amazon,
release: "2",
def: ovalmodels.Definition{
Advisory: ovalmodels.Advisory{
AffectedRepository: "amzn2-core",
},
AffectedPacks: []ovalmodels.Package{
{
Name: "nginx",
Version: "2.17-106.0.1",
Arch: "x86_64",
},
},
},
req: request{
packName: "nginx",
versionRelease: "2.17-105.0.1",
arch: "x86_64",
repository: "amzn2-core",
},
},
affected: true,
fixedIn: "2.17-106.0.1",
},
{
in: in{
family: constant.Amazon,
release: "2",
def: ovalmodels.Definition{
Advisory: ovalmodels.Advisory{
AffectedRepository: "amzn2-core",
},
AffectedPacks: []ovalmodels.Package{
{
Name: "nginx",
Version: "2.17-106.0.1",
Arch: "x86_64",
},
},
},
req: request{
packName: "nginx",
versionRelease: "2.17-105.0.1",
arch: "x86_64",
repository: "amzn2extra-nginx",
},
},
affected: false,
fixedIn: "",
},
}
for i, tt := range tests {
affected, notFixedYet, fixedIn, err := isOvalDefAffected(tt.in.def, tt.in.req, tt.in.family, tt.in.kernel, tt.in.mods)
affected, notFixedYet, fixedIn, err := isOvalDefAffected(tt.in.def, tt.in.req, tt.in.family, tt.in.release, tt.in.kernel, tt.in.mods)
if tt.wantErr != (err != nil) {
t.Errorf("[%d] err\nexpected: %t\n actual: %s\n", i, tt.wantErr, err)
}