Skip to content

Commit

Permalink
added opensuse tumbleweed testing
Browse files Browse the repository at this point in the history
linted
  • Loading branch information
msmeissn committed Jul 5, 2024
1 parent b73a6e7 commit b8a6b0e
Show file tree
Hide file tree
Showing 9 changed files with 9,887 additions and 17 deletions.
7 changes: 7 additions & 0 deletions integration/client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ func TestClientServer(t *testing.T) {
},
golden: "testdata/opensuse-leap-151.json.golden",
},
{
name: "opensuse tumbleweed",
args: csArgs{
Input: "testdata/fixtures/images/opensuse-tumbleweed.tar.gz",
},
golden: "testdata/opensuse-tumbleweed.json.golden",
},
{
name: "photon 3.0",
args: csArgs{
Expand Down
6 changes: 6 additions & 0 deletions integration/docker_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ func TestDockerEngine(t *testing.T) {
input: "testdata/fixtures/images/opensuse-leap-151.tar.gz",
golden: "testdata/opensuse-leap-151.json.golden",
},
{
name: "opensuse tumbleweed",
imageTag: "ghcr.io/aquasecurity/trivy-test-images:opensuse-tumbleweed",
input: "testdata/fixtures/images/opensuse-tumbleweed.tar.gz",
golden: "testdata/opensuse-tumbleweed.json.golden",
},
{
name: "photon 3.0",
imageTag: "ghcr.io/aquasecurity/trivy-test-images:photon-30",
Expand Down
8 changes: 8 additions & 0 deletions integration/standalone_tar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ func TestTar(t *testing.T) {
},
golden: "testdata/opensuse-leap-151.json.golden",
},
{
name: "opensuse tumbleweed",
args: args{
Format: types.FormatJSON,
Input: "testdata/fixtures/images/opensuse-tumbleweed.tar.gz",
},
golden: "testdata/opensuse-tumbleweed.json.golden",
},
{
name: "photon 3.0",
args: args{
Expand Down
13 changes: 12 additions & 1 deletion integration/testdata/fixtures/db/opensuse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,15 @@
pairs:
- key: "openSUSE-SU-2020:0062-1"
value:
FixedVersion: 1.1.0i-lp151.8.6.1
FixedVersion: 1.1.0i-lp151.8.6.1
- bucket: "openSUSE Tumbleweed"
pairs:
- bucket: libopenssl3
pairs:
- key: "openSUSE-SU-2024:13065-1"
value:
FixedVersion: 3.1.1-3.1
pairs:
- key: "openSUSE-SU-2024:13065-1"
value:
FixedVersion: 3.1.1-3.1
68 changes: 68 additions & 0 deletions integration/testdata/opensuse-tumbleweed.json.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"SchemaVersion": 2,
"CreatedAt": "2021-08-25T12:20:30.000000005Z",
"ArtifactName": "testdata/fixtures/images/opensuse-tumbleweed.tar.gz",
"ArtifactType": "container_image",
"Metadata": {
"OS": {
"Family": "opensuse.tumbleweed",
"Name": "20240607"
},
"ImageID": "sha256:580e73f5c823232e6587136e9f5428a89afdf77a123bb8575d08208e0cc34b12",
"DiffIDs": [
"sha256:7a335bdf2d91d6d158da360054aa7e477d708187d43fe9d0ac20144cdf90f763"
],
"ImageConfig": {
"architecture": "amd64",
"author": "Fabian Vogt \[email protected]\u003e",
"created": "2024-06-07T17:19:44Z",
"history": [
{
"author": "Fabian Vogt \[email protected]\u003e",
"created": "2024-06-07T17:19:44Z",
"created_by": "KIWI 10.0.19",
"comment": "openSUSE Tumbleweed 20240607 Base Container"
}
],
"os": "linux",
"rootfs": {
"type": "layers",
"diff_ids": [
"sha256:7a335bdf2d91d6d158da360054aa7e477d708187d43fe9d0ac20144cdf90f763"
]
},
"config": {
"Cmd": [
"/bin/bash"
],
"Labels": {
"org.openbuildservice.disturl": "obs://build.opensuse.org/openSUSE:Factory/images/b068e2522114e1c009e9bfa1b5cb1146-opensuse-tumbleweed-image:docker",
"org.opencontainers.image.created": "2024-06-07T17:19:38.229693664Z",
"org.opencontainers.image.description": "Image containing a minimal environment for containers based on openSUSE Tumbleweed.",
"org.opencontainers.image.source": "https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=b068e2522114e1c009e9bfa1b5cb1146",
"org.opencontainers.image.title": "openSUSE Tumbleweed Base Container",
"org.opencontainers.image.url": "https://www.opensuse.org/",
"org.opencontainers.image.vendor": "openSUSE Project",
"org.opencontainers.image.version": "20240607.30.45",
"org.opensuse.base.created": "2024-06-07T17:19:38.229693664Z",
"org.opensuse.base.description": "Image containing a minimal environment for containers based on openSUSE Tumbleweed.",
"org.opensuse.base.disturl": "obs://build.opensuse.org/openSUSE:Factory/images/b068e2522114e1c009e9bfa1b5cb1146-opensuse-tumbleweed-image:docker",
"org.opensuse.base.reference": "registry.opensuse.org/opensuse/tumbleweed:20240607.30.45",
"org.opensuse.base.source": "https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=b068e2522114e1c009e9bfa1b5cb1146",
"org.opensuse.base.title": "openSUSE Tumbleweed Base Container",
"org.opensuse.base.url": "https://www.opensuse.org/",
"org.opensuse.base.vendor": "openSUSE Project",
"org.opensuse.base.version": "20240607.30.45",
"org.opensuse.reference": "registry.opensuse.org/opensuse/tumbleweed:20240607.30.45"
}
}
}
},
"Results": [
{
"Target": "testdata/fixtures/images/opensuse-tumbleweed.tar.gz (opensuse.tumbleweed 20240607)",
"Class": "os-pkgs",
"Type": "opensuse.tumbleweed"
}
]
}
30 changes: 15 additions & 15 deletions pkg/detector/ospkg/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ var (
ErrUnsupportedOS = xerrors.New("unsupported os")

drivers = map[ftypes.OSType]Driver{
ftypes.Alpine: alpine.NewScanner(),
ftypes.Alma: alma.NewScanner(),
ftypes.Amazon: amazon.NewScanner(),
ftypes.CBLMariner: mariner.NewScanner(),
ftypes.Debian: debian.NewScanner(),
ftypes.Ubuntu: ubuntu.NewScanner(),
ftypes.RedHat: redhat.NewScanner(),
ftypes.CentOS: redhat.NewScanner(),
ftypes.Rocky: rocky.NewScanner(),
ftypes.Oracle: oracle.NewScanner(),
ftypes.Alpine: alpine.NewScanner(),
ftypes.Alma: alma.NewScanner(),
ftypes.Amazon: amazon.NewScanner(),
ftypes.CBLMariner: mariner.NewScanner(),
ftypes.Debian: debian.NewScanner(),
ftypes.Ubuntu: ubuntu.NewScanner(),
ftypes.RedHat: redhat.NewScanner(),
ftypes.CentOS: redhat.NewScanner(),
ftypes.Rocky: rocky.NewScanner(),
ftypes.Oracle: oracle.NewScanner(),
ftypes.OpenSUSETumbleweed: suse.NewScanner(suse.OpenSUSETumbleweed),
ftypes.OpenSUSELeap: suse.NewScanner(suse.OpenSUSE),
ftypes.SLES: suse.NewScanner(suse.SUSEEnterpriseLinux),
ftypes.Photon: photon.NewScanner(),
ftypes.Wolfi: wolfi.NewScanner(),
ftypes.Chainguard: chainguard.NewScanner(),
ftypes.OpenSUSELeap: suse.NewScanner(suse.OpenSUSE),
ftypes.SLES: suse.NewScanner(suse.SUSEEnterpriseLinux),
ftypes.Photon: photon.NewScanner(),
ftypes.Wolfi: wolfi.NewScanner(),
ftypes.Chainguard: chainguard.NewScanner(),
}
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/detector/ospkg/suse/suse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestScanner_Detect(t *testing.T) {
},
},
{
name: "happy tumbleweed path",
name: "happy path: tumbleweed",
fixtures: []string{
"testdata/fixtures/tumbleweed.yaml",
"testdata/fixtures/data-source.yaml",
Expand Down
9 changes: 9 additions & 0 deletions pkg/fanal/test/integration/library_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ var tests = []testCase{
Family: "opensuse.leap",
},
},
{
name: "happy path, opensuse tumbleweed",
remoteImageName: "ghcr.io/aquasecurity/trivy-test-images:opensuse-tumbleweed",
imageFile: "../../../../integration/testdata/fixtures/images/opensuse-tumbleweed.tar.gz",
wantOS: types.OS{
Name: "20240607",
Family: "opensuse.tumbleweed",
},
},
{
// from registry.suse.com/suse/sle15:15.3.17.8.16
name: "happy path, suse 15.3 (NDB)",
Expand Down
Loading

0 comments on commit b8a6b0e

Please sign in to comment.