-
Notifications
You must be signed in to change notification settings - Fork 22
SBOM Deletion Performance Tests #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vobratil
wants to merge
12
commits into
guacsec:main
Choose a base branch
from
vobratil:delete-perf-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bcdec94
Added SBOM deletion performance tests.
vobratil 0e077fa
Replaced the upload function in global setup with a reusable function…
vobratil ae14510
Applied CI-recommended fixes.
vobratil d6c397d
Renamed the delete performance tests file.
vobratil 18ee1d3
Changed the sbomIds variable to be file-scoped, not global-scoped.
vobratil c9d4f2a
Applied group tagging to the deletion performance tests.
vobratil 157c005
Forced sequential test execution.
vobratil e86aefa
Removed unnecessary comments in fixtures.
vobratil 5b2c2a4
Moved the uploadAdvisory method to helpers.
vobratil f4d2f6b
The whole response from the uploadSbom function is now available.
vobratil ca50795
Fixed formatting.
vobratil 8f4c632
Cleaned up the deleteSboms helper function.
vobratil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,3 +48,7 @@ e2e/tests/ui/features/**/auto-generated.step.ts | |
|
|
||
| # Test results | ||
| test-results/ | ||
|
|
||
| # Reports | ||
| *.csv | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.12 KB
e2e/tests/api/features/assets/performance/delete/1.46.0-26.el9_4-product.json.bz2
Binary file not shown.
Binary file added
BIN
+17.1 KB
e2e/tests/api/features/assets/performance/delete/1.46.0-26.el9_4-release.json.bz2
Binary file not shown.
Binary file added
BIN
+1.12 KB
e2e/tests/api/features/assets/performance/delete/1.46.0-27.el9_4-product.json.bz2
Binary file not shown.
Binary file added
BIN
+17.1 KB
e2e/tests/api/features/assets/performance/delete/1.46.0-27.el9_4-release.json.bz2
Binary file not shown.
Binary file added
BIN
+154 KB
e2e/tests/api/features/assets/performance/delete/1_devspaces_pluginregistry-rhel8.json.bz2
Binary file not shown.
Binary file added
BIN
+68 KB
e2e/tests/api/features/assets/performance/delete/1_devspaces_server-rhel8.json.bz2
Binary file not shown.
Binary file added
BIN
+52.2 KB
...s/api/features/assets/performance/delete/3_quarkus-bom-3.2.10.Final-redhat-00002.json.bz2
Binary file not shown.
Binary file added
BIN
+52.2 KB
...s/api/features/assets/performance/delete/3_quarkus-bom-3.2.11.Final-redhat-00001.json.bz2
Binary file not shown.
Binary file added
BIN
+52.1 KB
...s/api/features/assets/performance/delete/3_quarkus-bom-3.2.12.Final-redhat-00002.json.bz2
Binary file not shown.
Binary file added
BIN
+49.9 KB
...ts/api/features/assets/performance/delete/3_quarkus-bom-3.2.6.Final-redhat-00002.json.bz2
Binary file not shown.
Binary file added
BIN
+52 KB
...ts/api/features/assets/performance/delete/3_quarkus-bom-3.2.9.Final-redhat-00003.json.bz2
Binary file not shown.
Binary file added
BIN
+28 KB
e2e/tests/api/features/assets/performance/delete/4_RHEL-9-FAST-DATAPATH.json.bz2
Binary file not shown.
Binary file added
BIN
+205 KB
...i/features/assets/performance/delete/jboss-eap-7_eap74-openjdk11-openshift-rhel8.json.bz2
Binary file not shown.
Binary file added
BIN
+208 KB
...pi/features/assets/performance/delete/jboss-eap-7_eap74-openjdk8-openshift-rhel8.json.bz2
Binary file not shown.
Binary file added
BIN
+22.9 KB
...ests/api/features/assets/performance/delete/quay-builder-qemu-rhcos-rhel-8-amd64.json.bz2
Binary file not shown.
Binary file added
BIN
+1.23 KB
...pi/features/assets/performance/delete/quay-builder-qemu-rhcos-rhel-8-image-index.json.bz2
Binary file not shown.
Binary file added
BIN
+873 Bytes
...ts/api/features/assets/performance/delete/quay-builder-qemu-rhcos-rhel-8-product.json.bz2
Binary file not shown.
Binary file added
BIN
+22.9 KB
...eatures/assets/performance/delete/quay-builder-qemu-rhcos-rhel8-v3.14.0-4-binary.json.bz2
Binary file not shown.
Binary file added
BIN
+1.2 KB
...features/assets/performance/delete/quay-builder-qemu-rhcos-rhel8-v3.14.0-4-index.json.bz2
Binary file not shown.
Binary file added
BIN
+2 KB
e2e/tests/api/features/assets/performance/delete/quay-v3.14.0-product.json.bz2
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| import { logger } from "../../common/constants"; | ||
| import { test } from "../fixtures"; | ||
| import { deleteSboms } from "../helpers/delete"; | ||
| import { writeRequestDurationToFile } from "../helpers/report"; | ||
| import { uploadSboms } from "../helpers/upload"; | ||
|
|
||
| test.describe.configure({ mode: "serial" }); | ||
|
|
||
| const SBOM_DIR = "../features/assets/performance/delete"; // The path is relative to the helpers/upload.ts file. | ||
| const SBOM_FILES = [ | ||
| "1_devspaces_pluginregistry-rhel8.json.bz2", | ||
| "1_devspaces_server-rhel8.json.bz2", | ||
| "1.46.0-26.el9_4-product.json.bz2", | ||
| "1.46.0-26.el9_4-release.json.bz2", | ||
| "1.46.0-27.el9_4-product.json.bz2", | ||
| "1.46.0-27.el9_4-release.json.bz2", | ||
| "3_quarkus-bom-3.2.6.Final-redhat-00002.json.bz2", | ||
| "3_quarkus-bom-3.2.9.Final-redhat-00003.json.bz2", | ||
| "3_quarkus-bom-3.2.10.Final-redhat-00002.json.bz2", | ||
| "3_quarkus-bom-3.2.11.Final-redhat-00001.json.bz2", | ||
| "3_quarkus-bom-3.2.12.Final-redhat-00002.json.bz2", | ||
| "4_RHEL-9-FAST-DATAPATH.json.bz2", | ||
| "jboss-eap-7_eap74-openjdk8-openshift-rhel8.json.bz2", | ||
| "jboss-eap-7_eap74-openjdk11-openshift-rhel8.json.bz2", | ||
| "quay-builder-qemu-rhcos-rhel-8-amd64.json.bz2", | ||
| "quay-builder-qemu-rhcos-rhel-8-image-index.json.bz2", | ||
| "quay-builder-qemu-rhcos-rhel-8-product.json.bz2", | ||
| "quay-builder-qemu-rhcos-rhel8-v3.14.0-4-binary.json.bz2", | ||
| "quay-builder-qemu-rhcos-rhel8-v3.14.0-4-index.json.bz2", | ||
| "quay-v3.14.0-product.json.bz2", | ||
| ]; | ||
|
|
||
| let sbomIds: string[] = []; | ||
|
|
||
| const REPORT_FILE_PREFIX = "report-perf-delete-"; | ||
|
|
||
| test.describe("Performance / Deletion", { tag: "@performance" }, () => { | ||
| test.beforeEach(async ({ axios }) => { | ||
| logger.info("Uploading SBOMs before deletion performance tests."); | ||
|
|
||
| const uploadResponses = await uploadSboms(axios, SBOM_DIR, SBOM_FILES); | ||
|
|
||
| uploadResponses.forEach((response) => { | ||
| sbomIds.push(response.data.id); | ||
| }); | ||
|
|
||
| sbomIds.forEach((id) => { | ||
| logger.info(id); | ||
| }); | ||
|
|
||
| logger.info(`Uploaded ${sbomIds.length} SBOMs.`); | ||
| }); | ||
|
|
||
| test("SBOMs / Sequential", async ({ axios }) => { | ||
| const currentTimeStamp = Date.now(); | ||
| const reportFile = `${REPORT_FILE_PREFIX}sequential-${currentTimeStamp}.csv`; | ||
| var index = 1; | ||
|
|
||
| var duration = ""; | ||
|
|
||
| writeRequestDurationToFile(reportFile, "No.", "SBOM ID", "Duration [ms]"); | ||
|
|
||
| for (const sbomId of sbomIds) { | ||
| try { | ||
| await axios.delete(`/api/v2/sbom/${sbomId}`).then((response) => { | ||
| duration = String(response.duration); | ||
| }); | ||
| } catch (error) { | ||
| logger.error(`SBOM with ID ${sbomId} could not be deleted.`, error); | ||
| duration = "n/a"; | ||
| } | ||
|
|
||
| writeRequestDurationToFile(reportFile, String(index), sbomId, duration); | ||
| duration = ""; | ||
| index++; | ||
| } | ||
| }); | ||
|
|
||
| test("SBOMs / Parallel", async ({ axios }) => { | ||
| const currentTimeStamp = Date.now(); | ||
| const reportFile = `${REPORT_FILE_PREFIX}parallel-${currentTimeStamp}.csv`; | ||
|
|
||
| writeRequestDurationToFile(reportFile, "No.", "SBOM ID", "Duration [ms]"); | ||
|
|
||
| const deletionPromises = sbomIds.map(async (sbomId) => { | ||
| const deletePromise = axios | ||
| .delete(`/api/v2/sbom/${sbomId}`) | ||
| .then((response) => | ||
| writeRequestDurationToFile( | ||
| reportFile, | ||
| "n/a", | ||
| response.data.id, | ||
| String(response.duration), | ||
| ), | ||
| ) | ||
| .catch((error) => { | ||
| logger.error(`SBOM with ID ${sbomId} could not be deleted.`, error); | ||
| }); | ||
|
|
||
| return deletePromise; | ||
| }); | ||
|
|
||
| await Promise.all(deletionPromises); | ||
| }); | ||
|
|
||
| // Re-try deletion of all SBOMs in case some of the SBOMs didn't get deleted during the tests. | ||
| test.afterEach(async ({ axios }) => { | ||
| logger.info("Cleaning up SBOMs after deletion performance tests."); | ||
|
|
||
| const deleteResponses = await deleteSboms(axios, sbomIds); | ||
|
|
||
| if ( | ||
| deleteResponses.every( | ||
| (result) => | ||
| result.status === "fulfilled" && result.value?.status === 200, | ||
| ) | ||
| ) { | ||
| logger.info("All SBOMS have been deleted successfully."); | ||
| } else { | ||
| logger.warn( | ||
| "Some SBOM deletions were unsuccessful. Check the logs and/or consider deleting the SBOMs manually.", | ||
| ); | ||
| } | ||
|
|
||
| sbomIds = []; | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import type { AxiosInstance } from "axios"; | ||
|
|
||
| import { logger } from "../../common/constants"; | ||
|
|
||
| export async function deleteSboms(axios: AxiosInstance, sbomIds: string[]) { | ||
| var existingSbomIds = []; | ||
|
|
||
| for (const sbomId of sbomIds) { | ||
| try { | ||
| await axios.get(`/api/v2/sbom/${sbomId}`); | ||
| existingSbomIds.push(sbomId); | ||
| } catch (_error) { | ||
| logger.info(`SBOM with ID ${sbomId} does not exist anymore. Skipping.`); | ||
| } | ||
| } | ||
|
Comment on lines
+8
to
+15
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is not necessary... since it is only cleaning we can call directly |
||
|
|
||
| const deletionPromises = existingSbomIds.map((sbomId) => | ||
| axios.delete(`/api/v2/sbom/${sbomId}`), | ||
| ); | ||
|
|
||
| const responses = await Promise.allSettled(deletionPromises); | ||
|
|
||
| return responses; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.