Skip to content

Commit

Permalink
Make wiremock an optional dependency
Browse files Browse the repository at this point in the history
Make a wiremock optional, enabled when the 'testing' feature is enabled.
The goal is to reduce the number of dependencies, with the downside that
the test code coverage will drop.

Wiremock is currently used only on 'registrar_agent' tests to mock
responses from the registrar service.

Note: wiremock was moved to be an optional regular dependency because
optional dev-dependencies are not supported.
see: rust-lang/cargo#1596

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
  • Loading branch information
ansasaki committed Jun 10, 2022
1 parent bd985d1 commit c31174a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@ tss-esapi = "7.1.0"
thiserror = "1.0"
uuid = {version = "0.8", features = ["v4"]}
zmq = {version = "0.9.2", optional = true}
# wiremock was moved to be a regular dependency because optional
# dev-dependencies are not supported
# see: https://github.com/rust-lang/cargo/issues/1596
wiremock = {version = "0.5", optional = true}

[dev-dependencies]
actix-rt = "2"
wiremock = "0.5"

[features]
# The features enabled by default
default = ["with-zmq", "legacy-python-actions"]
# this should change to dev-dependencies when we have integration testing
testing = []
testing = ["wiremock"]
# Whether the agent should be compiled with support to listen for notification
# messages on ZeroMQ
with-zmq = ["zmq"]
Expand Down
1 change: 1 addition & 0 deletions src/registrar_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub(crate) async fn do_register_agent(
}
}

#[cfg(feature = "testing")]
#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit c31174a

Please sign in to comment.