diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-06-21 16:18:22 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-06-21 16:25:55 +0200 |
commit | 719991b78af9ac6915179209771be4138065e182 (patch) | |
tree | d254892b578d9e7685d08822e4b05802614e8807 | |
parent | abeb43732a2a9b45453e6acb6df3de2395659943 (diff) |
Use a cargo feature to allow disabling docker tests in CI
Ideally these tests would run in CI, but that would require docker in docker,
since CI runs its tests in docker.
-rw-r--r-- | .woodpecker.yml | 2 | ||||
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | tests/server_shell.rs | 7 |
4 files changed, 18 insertions, 1 deletions
diff --git a/.woodpecker.yml b/.woodpecker.yml index f3b0e5c..cee339a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,4 +4,4 @@ pipeline: environment: [CARGO_TERM_COLOR=always] commands: - rustup default stable - - cargo test + - cargo test --no-default-features diff --git a/CHANGELOG.md b/CHANGELOG.md index cd6ea83..598ff2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Added feature flag "docker_tests". This only affects which tests are run by + default, so that the CI environment can skip tests that require running + docker. + ## [0.1.1] - 2023-05-10 ### Changed @@ -31,6 +31,10 @@ once_cell = "1.17.1" tempfile = "3.4.0" rexpect = "0.5.0" +[features] +docker_tests = [] +default = ["docker_tests"] + [profile.dev.package."*"] opt-level = 3 # incremental compile is rarely useful for dependencies since they change diff --git a/tests/server_shell.rs b/tests/server_shell.rs index 22f3d3b..806f901 100644 --- a/tests/server_shell.rs +++ b/tests/server_shell.rs @@ -164,6 +164,7 @@ fn make_new_shared_repo(c: &TestContext, group: &str, repo_name: &str) -> Result } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn shows_a_prompt() -> Result<()> { let c = spawn_ssh_server()?; connect_to_ssh_server_interactively(&c)?; @@ -237,6 +238,7 @@ fn commit_dummy_content(c: &TestContext, repo_name: &str) -> Result<()> { } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn git_clone_works_with_an_empty_repo() -> Result<()> { let c = spawn_ssh_server()?; let repo_name = "my-new-clonable-repo"; @@ -247,6 +249,7 @@ fn git_clone_works_with_an_empty_repo() -> Result<()> { } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn git_push_works() -> Result<()> { let c = spawn_ssh_server()?; let repo_name = "my-new-pushable-repo"; @@ -259,6 +262,7 @@ fn git_push_works() -> Result<()> { } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn git_clone_works_with_an_empty_shared_repo() -> Result<()> { let c = spawn_ssh_server()?; let repo_name = "my-new-clonable-repo"; @@ -270,6 +274,7 @@ fn git_clone_works_with_an_empty_shared_repo() -> Result<()> { } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn git_push_works_with_shared_repo() -> Result<()> { let c = spawn_ssh_server()?; let repo_name = "my-new-pushable-repo"; @@ -283,6 +288,7 @@ fn git_push_works_with_shared_repo() -> Result<()> { } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn git_clone_can_not_target_repo_outside_allowed_paths() -> Result<()> { fn test_git_clone_unallowed_path(repo_name: &str) -> Result<()> { let c = spawn_ssh_server()?; @@ -319,6 +325,7 @@ fn init_local_git_dir(c: &TestContext, repo_name: &str) { } #[test] +#[cfg_attr(not(feature = "docker_tests"), ignore)] fn git_push_can_not_target_repo_outside_allowed_paths() -> Result<()> { fn test_push_to_unallowed_path(repo_name: &str) -> Result<()> { let c = spawn_ssh_server()?; |