Skip to content

Commit

Permalink
e2e trustification-based test: added FindDependentProduct
Browse files Browse the repository at this point in the history
Signed-off-by: mrizzi <[email protected]>
  • Loading branch information
mrizzi committed Nov 28, 2023
1 parent 8036926 commit b1d2624
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
47 changes: 47 additions & 0 deletions demo/graphql/queries-trustification.gql
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,45 @@ fragment allCertifyVEXStatementTree on CertifyVEXStatement {
collector
}

fragment allHasSBOMTree on HasSBOM {
id
subject {
__typename
... on Package {
id
type
namespaces {
id
namespace
names {
id
name
versions {
id
version
qualifiers {
key
value
}
subpath
}
}
}
}
... on Artifact {
id
algorithm
digest
}
}
uri
algorithm
digest
downloadLocation
origin
collector
}

query FindVulnerabilitySbomURI_quarkus {
findVulnerabilityBySbomURI (
sbomURI:"https://access.redhat.com/security/data/sbom/beta/spdx/quarkus-bom-d6ecbbd9-31bf-46fd-afda-8082120f5260", offset:0, limit:1000) {
Expand Down Expand Up @@ -286,3 +325,11 @@ query FindRelatedProducts {
}
}
}

query FindDependentProduct {
findDependentProduct(
purl: "pkg:rpm/redhat/[email protected]_8?arch=x86_64", offset: 0, limit: 10
) {
...allHasSBOMTree
}
}
3 changes: 3 additions & 0 deletions internal/testing/e2e-trustification/e2e
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ diff -u "${SCRIPT_DIR}/expectFindVulnerabilitySbomURI_ubi8.json" "${GUAC_DIR}/go
cat ./demo/graphql/queries-trustification.gql | gql-cli http://localhost:8080/query -o FindRelatedProducts | jq 'del(.. | .id?) | del(.. | .origin?) | .findTopLevelPackagesRelatedToVulnerability[] | length' > "${GUAC_DIR}/gotFindRelatedProducts.json"
diff -u "${SCRIPT_DIR}/expectFindRelatedProducts.json" "${GUAC_DIR}/gotFindRelatedProducts.json"

cat ./demo/graphql/queries-trustification.gql | gql-cli http://localhost:8080/query -o FindDependentProduct | jq 'del(.. | .id?) | del(.. | .downloadLocation?) | .findDependentProduct' > "${GUAC_DIR}/gotFindDependentProduct.json"
diff -u "${SCRIPT_DIR}/expectFindDependentProduct.json" "${GUAC_DIR}/gotFindDependentProduct.json"

# Note: graphql_playground is left running, CI will clean it up
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"subject": {
"__typename": "Package",
"type": "oci",
"namespaces": [
{
"namespace": "registry.redhat.io/ubi8-minimal",
"names": [
{
"name": "ubi8-minimal-container",
"versions": [
{
"version": "sha256:b93deceb59a58588d5b16429fc47f98920f84740a1f2ed6454e33275f0701b59",
"qualifiers": [
{
"key": "tag",
"value": "8.8-1072.1697626218"
}
],
"subpath": ""
}
]
}
]
}
]
},
"uri": "https://access.redhat.com/security/data/sbom/beta/spdx/ubi8-minimal-container-5b43ae22-cbf0-4626-8ec5-4ae0765a3d4b",
"algorithm": "sha256",
"digest": "3d99f13040baaa0e682e6e3e1500907a78babe741ab3d3c2bacc13963e1d3646",
"origin": "",
"collector": ""
}
]

0 comments on commit b1d2624

Please sign in to comment.