Skip to content

Commit

Permalink
feat(cli): add mage command to update golden integration test files (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen authored May 16, 2023
1 parent 1a56295 commit d298415
Show file tree
Hide file tree
Showing 20 changed files with 120 additions and 79 deletions.
3 changes: 3 additions & 0 deletions integration/client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ func TestClientServerWithFormat(t *testing.T) {
}

func TestClientServerWithCycloneDX(t *testing.T) {
if *update {
t.Skipf("This test doesn't use golden files")
}
tests := []struct {
name string
args csArgs
Expand Down
3 changes: 3 additions & 0 deletions integration/docker_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
)

func TestDockerEngine(t *testing.T) {
if *update {
t.Skipf("This test doesn't update golden files")
}
tests := []struct {
name string
imageTag string
Expand Down
18 changes: 9 additions & 9 deletions integration/testdata/alpine-310-registry.json.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"SchemaVersion": 2,
"ArtifactName": "localhost:63577/alpine:3.10",
"ArtifactName": "localhost:32839/alpine:3.10",
"ArtifactType": "container_image",
"Metadata": {
"OS": {
Expand All @@ -13,10 +13,10 @@
"sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0"
],
"RepoTags": [
"localhost:63577/alpine:3.10"
"localhost:32839/alpine:3.10"
],
"RepoDigests": [
"localhost:63577/alpine@sha256:d9b1a0d4fab413443a22e550cb8720de487295cebca3f9b2fcbf8882192a9bf9"
"localhost:32839/alpine@sha256:b1c5a500182b21d0bfa5a584a8526b56d8be316f89e87d951be04abed2446e60"
],
"ImageConfig": {
"architecture": "amd64",
Expand Down Expand Up @@ -55,7 +55,7 @@
},
"Results": [
{
"Target": "localhost:63577/alpine:3.10 (alpine 3.10.2)",
"Target": "localhost:32839/alpine:3.10 (alpine 3.10.2)",
"Class": "os-pkgs",
"Type": "alpine",
"Vulnerabilities": [
Expand All @@ -66,7 +66,7 @@
"InstalledVersion": "1.1.1c-r0",
"FixedVersion": "1.1.1d-r0",
"Layer": {
"Digest": "sha256:3489774ebf88fb1f0b08e0abb45826a3cbd9d0eb6458d5fc54729197feddffb9",
"Digest": "sha256:9d48c3bd43c520dc2784e868a780e976b207cbf493eaff8c6596eb871cbd9609",
"DiffID": "sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0"
},
"SeveritySource": "nvd",
Expand Down Expand Up @@ -126,7 +126,7 @@
"InstalledVersion": "1.1.1c-r0",
"FixedVersion": "1.1.1d-r2",
"Layer": {
"Digest": "sha256:3489774ebf88fb1f0b08e0abb45826a3cbd9d0eb6458d5fc54729197feddffb9",
"Digest": "sha256:9d48c3bd43c520dc2784e868a780e976b207cbf493eaff8c6596eb871cbd9609",
"DiffID": "sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0"
},
"SeveritySource": "nvd",
Expand Down Expand Up @@ -196,7 +196,7 @@
"InstalledVersion": "1.1.1c-r0",
"FixedVersion": "1.1.1d-r0",
"Layer": {
"Digest": "sha256:3489774ebf88fb1f0b08e0abb45826a3cbd9d0eb6458d5fc54729197feddffb9",
"Digest": "sha256:9d48c3bd43c520dc2784e868a780e976b207cbf493eaff8c6596eb871cbd9609",
"DiffID": "sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0"
},
"SeveritySource": "nvd",
Expand Down Expand Up @@ -256,7 +256,7 @@
"InstalledVersion": "1.1.1c-r0",
"FixedVersion": "1.1.1d-r2",
"Layer": {
"Digest": "sha256:3489774ebf88fb1f0b08e0abb45826a3cbd9d0eb6458d5fc54729197feddffb9",
"Digest": "sha256:9d48c3bd43c520dc2784e868a780e976b207cbf493eaff8c6596eb871cbd9609",
"DiffID": "sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0"
},
"SeveritySource": "nvd",
Expand Down Expand Up @@ -322,4 +322,4 @@
]
}
]
}
}
4 changes: 2 additions & 2 deletions integration/testdata/busybox-with-lockfile.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2019-15542",
"PkgName": "ammonia",
"PkgID": "ammonia@1.9.0",
"PkgName": "ammonia",
"InstalledVersion": "1.9.0",
"FixedVersion": "\u003e= 2.1.0",
"Layer": {
Expand Down Expand Up @@ -92,8 +92,8 @@
},
{
"VulnerabilityID": "CVE-2021-38193",
"PkgName": "ammonia",
"PkgID": "ammonia@1.9.0",
"PkgName": "ammonia",
"InstalledVersion": "1.9.0",
"FixedVersion": "\u003e= 3.1.0, \u003e= 2.1.3, \u003c 3.0.0",
"Layer": {
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/centos-7-cyclonedx.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"specVersion": "1.4",
"version": 1,
"metadata": {
"timestamp": "2022-08-14T12:39:11+00:00",
"timestamp": "2023-05-15T09:50:02+00:00",
"tools": [
{
"vendor": "aquasecurity",
Expand Down
15 changes: 10 additions & 5 deletions integration/testdata/cocoapods.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,38 @@
"DependsOn": [
"AppCenter/Analytics/4.2.0",
"AppCenter/Crashes/4.2.0"
]
],
"Layer": {}
},
{
"ID": "AppCenter/Analytics/4.2.0",
"Name": "AppCenter/Analytics",
"Version": "4.2.0",
"DependsOn": [
"AppCenter/Core/4.2.0"
]
],
"Layer": {}
},
{
"ID": "AppCenter/Core/4.2.0",
"Name": "AppCenter/Core",
"Version": "4.2.0"
"Version": "4.2.0",
"Layer": {}
},
{
"ID": "AppCenter/Crashes/4.2.0",
"Name": "AppCenter/Crashes",
"Version": "4.2.0",
"DependsOn": [
"AppCenter/Core/4.2.0"
]
],
"Layer": {}
},
{
"ID": "KeychainAccess/4.2.1",
"Name": "KeychainAccess",
"Version": "4.2.1"
"Version": "4.2.1",
"Layer": {}
}
]
}
Expand Down
7 changes: 3 additions & 4 deletions integration/testdata/composer.lock.json.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 27 additions & 7 deletions integration/testdata/conan.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
"SchemaVersion": 2,
"ArtifactName": "testdata/fixtures/fs/conan",
"ArtifactType": "filesystem",
"Metadata": {
"ImageConfig": {
"architecture": "",
"created": "0001-01-01T00:00:00Z",
"os": "",
"rootfs": {
"type": "",
"diff_ids": null
},
"config": {}
}
},
"Results": [
{
"Target": "conan.lock",
Expand All @@ -12,19 +24,22 @@
"ID": "bzip2/1.0.8",
"Name": "bzip2",
"Version": "1.0.8",
"Indirect": true
"Indirect": true,
"Layer": {}
},
{
"ID": "expat/2.4.8",
"Name": "expat",
"Version": "2.4.8",
"Indirect": true
"Indirect": true,
"Layer": {}
},
{
"ID": "openssl/1.1.1q",
"Name": "openssl",
"Version": "1.1.1q",
"Indirect": true
"Indirect": true,
"Layer": {}
},
{
"ID": "pcre/8.43",
Expand All @@ -34,7 +49,8 @@
"DependsOn": [
"bzip2/1.0.8",
"zlib/1.2.12"
]
],
"Layer": {}
},
{
"ID": "poco/1.9.4",
Expand All @@ -46,19 +62,22 @@
"expat/2.4.8",
"sqlite3/3.39.2",
"openssl/1.1.1q"
]
],
"Layer": {}
},
{
"ID": "sqlite3/3.39.2",
"Name": "sqlite3",
"Version": "3.39.2",
"Indirect": true
"Indirect": true,
"Layer": {}
},
{
"ID": "zlib/1.2.12",
"Name": "zlib",
"Version": "1.2.12",
"Indirect": true
"Indirect": true,
"Layer": {}
}
],
"Vulnerabilities": [
Expand All @@ -68,6 +87,7 @@
"PkgName": "pcre",
"InstalledVersion": "8.43",
"FixedVersion": "8.45",
"Layer": {},
"Severity": "UNKNOWN"
}
]
Expand Down
10 changes: 5 additions & 5 deletions integration/testdata/conda-cyclonedx.json.golden
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.4",
"serialNumber": "urn:uuid:4dd4cf4a-d4de-4ea0-b75f-ad617f31b5a9",
"serialNumber": "urn:uuid:c283a9bb-93f1-49fb-9605-110b5f005a74",
"version": 1,
"metadata": {
"timestamp": "2023-01-08T23:57:37+00:00",
"timestamp": "2023-05-15T09:49:59+00:00",
"tools": [
{
"vendor": "aquasecurity",
Expand All @@ -13,7 +13,7 @@
}
],
"component": {
"bom-ref": "582a7c6f-b30e-4b65-a911-f3f5034aa003",
"bom-ref": "6497c0eb-7ca3-401e-b1f6-29234b2ec32c",
"type": "application",
"name": "testdata/fixtures/fs/conda",
"properties": [
Expand Down Expand Up @@ -72,12 +72,12 @@
],
"dependencies": [
{
"ref": "582a7c6f-b30e-4b65-a911-f3f5034aa003",
"ref": "6497c0eb-7ca3-401e-b1f6-29234b2ec32c",
"dependsOn": [
"pkg:conda/openssl@1.1.1q?file_path=miniconda3%2Fenvs%2Ftestenv%2Fconda-meta%2Fopenssl-1.1.1q-h7f8727e_0.json",
"pkg:conda/pip@22.2.2?file_path=miniconda3%2Fenvs%2Ftestenv%2Fconda-meta%2Fpip-22.2.2-py38h06a4308_0.json"
]
}
],
"vulnerabilities": []
}
}
Loading

0 comments on commit d298415

Please sign in to comment.