Skip to content

Commit

Permalink
fix: deunstable the spog_dependencies integ test
Browse files Browse the repository at this point in the history
Fixes trustification#618

We wait on guac up to the ntest::timeout value, 30s. This should
account for a slow-to-start-up guac container.

Signed-off-by: Jim Crossley <[email protected]>
  • Loading branch information
jcrossley3 committed Oct 24, 2023
1 parent 61b5fd7 commit a607b04
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions integration-tests/tests/spog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ async fn spog_search_correlation(context: &mut SpogContext) {

/// SPoG is the entrypoint for the frontend. It exposes an dependencies API, but forwards requests
/// to Guac. This test is here to test this.
#[ignore = "Unstable test, issue #618"]
#[test_context(SpogContext)]
#[tokio::test]
#[ntest::timeout(30_000)]
Expand All @@ -196,7 +195,6 @@ async fn spog_dependencies(context: &mut SpogContext) {

let purl: &str = "pkg:rpm/redhat/[email protected]";

let mut attempt = 1;
loop {
let response = client
.get(context.urlify("/api/v1/packages"))
Expand All @@ -207,17 +205,13 @@ async fn spog_dependencies(context: &mut SpogContext) {
.send()
.await
.unwrap();
assert_eq!(response.status(), StatusCode::OK);

let payload: Value = response.json().await.unwrap();
let pkgs = payload.as_array().unwrap();
if pkgs.contains(&json!({"purl": "pkg:rpm/[email protected]?arch=x86_64"})) {
break;
if response.status() == StatusCode::OK {
let payload: Value = response.json().await.unwrap();
let pkgs = payload.as_array().unwrap();
if pkgs.contains(&json!({"purl": "pkg:rpm/[email protected]?arch=x86_64"})) {
break;
}
}

attempt += 1;
assert!(attempt < 10, "Guac ingestion failed, no packages available");
// wait a bit until the SBOM gets ingested into Guac
tokio::time::sleep(Duration::from_secs(1)).await;
}

Expand Down

0 comments on commit a607b04

Please sign in to comment.