Skip to content

Commit

Permalink
feat: add feature flag for running acceptance tests only
Browse files Browse the repository at this point in the history
Acceptance tests are a subset of tests that can run successfully in a containerized environment against a production cluster
  • Loading branch information
Ulf Lilleengen committed Oct 3, 2023
1 parent 158bea6 commit 38866f5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ urlencoding = "2.1.2"
[dev-dependencies]
env_logger = "0.10"
spog-model = { path = "../spog/model" }

[features]
acceptance-tests = []
2 changes: 1 addition & 1 deletion integration-tests/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY . /usr/src/project
WORKDIR /usr/src/project

ARG tag
RUN TAG=$tag cargo test --no-run -p integration-tests --release
RUN TAG=$tag cargo test --no-run -p integration-tests --release --features acceptance-tests
RUN mkdir -p test-binaries
RUN find target/release/deps/ -type f ! -name "*.*" ! -name "integration_tests*" | xargs -I{} cp {} test-binaries/

Expand Down
6 changes: 6 additions & 0 deletions integration-tests/tests/bombastic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async fn delete_missing_sbom(context: &mut BombasticContext) {
assert_eq!(response.status(), StatusCode::NO_CONTENT);
}

#[cfg(not(feature = "acceptance-tests"))]
#[test_context(BombasticContext)]
#[tokio::test]
#[ntest::timeout(60_000)]
Expand All @@ -123,6 +124,7 @@ async fn reject_no_auth_upload(context: &mut BombasticContext) {
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
}

#[cfg(not(feature = "acceptance-tests"))]
#[test_context(BombasticContext)]
#[tokio::test]
#[ntest::timeout(60_000)]
Expand Down Expand Up @@ -333,6 +335,7 @@ async fn upload_sbom_existing_with_change(context: &mut BombasticContext) {
);
}

#[cfg(not(feature = "acceptance-tests"))]
#[ignore = "until API can support failures so that event bus is not needed to check"]
#[test_context(BombasticContext)]
#[tokio::test]
Expand All @@ -358,6 +361,7 @@ async fn sbom_upload_empty_json(context: &mut BombasticContext) {
context.delete_sbom(id).await;
}

#[cfg(not(feature = "acceptance-tests"))]
#[ignore = "until API can support failures so that event bus is not needed to check"]
#[test_context(BombasticContext)]
#[tokio::test]
Expand All @@ -379,6 +383,7 @@ async fn sbom_upload_empty_file(context: &mut BombasticContext) {
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
}

#[cfg(not(feature = "acceptance-tests"))]
#[test_context(BombasticContext)]
#[tokio::test]
#[ntest::timeout(60_000)]
Expand Down Expand Up @@ -410,6 +415,7 @@ async fn sbom_upload_unauthorized(context: &mut BombasticContext) {
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
}

#[cfg(not(feature = "acceptance-tests"))]
#[test_context(BombasticContext)]
#[tokio::test]
#[ntest::timeout(60_000)]
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/tests/vexination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ async fn vex_invalid_encoding(vexination: &mut VexinationContext) {
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
}

#[cfg(not(feature = "acceptance-tests"))]
#[ignore = "until API can support failures so that event bus is not needed to check"]
#[test_context(VexinationContext)]
#[tokio::test]
Expand All @@ -180,6 +181,7 @@ async fn upload_vex_empty_json(context: &mut VexinationContext) {
context.delete_vex(id).await;
}

#[cfg(not(feature = "acceptance-tests"))]
#[ignore = "until API can support failures so that event bus is not needed to check"]
#[test_context(VexinationContext)]
#[tokio::test]
Expand All @@ -206,6 +208,7 @@ async fn upload_vex_empty_file(vexination: &mut VexinationContext) {
vexination.delete_vex(id).await;
}

#[cfg(not(feature = "acceptance-tests"))]
#[test_context(VexinationContext)]
#[tokio::test]
#[ntest::timeout(60_000)]
Expand Down

0 comments on commit 38866f5

Please sign in to comment.