Add feature-flags to exclude some integration tests.

This reduces the number of external services that must be running to
succesful run 'cargo test'. In this case one the requirements that
ChirpStack has must be present and there is no need to run local
Kafka and RabbitMQ instances.

These integrations can still be tested using the 'test-all-integrations'
feature flag (which is included in the CI workflow).
This commit is contained in:
Orne Brocaar 2023-06-26 12:44:22 +01:00
parent 2184e4eaa5
commit b263b86675
6 changed files with 21 additions and 3 deletions

View File

@ -60,3 +60,10 @@ test:
cd chirpstack && make test
cd lrwn && make test
cd lrwn-filters && make test
# Runs all the tests (including some that normally are ignored)
test-all:
cd backend && cargo test
cd chirpstack && make test-all
cd lrwn && make test
cd lrwn-filters && make test

View File

@ -134,6 +134,12 @@ httpmock = "0.6"
bytes = "1.4"
dotenv = "0.15"
[features]
test-all-integrations = ["test-integration-amqp", "test-integration-kafka", "test-integration-mqtt"]
test-integration-amqp = []
test-integration-kafka = []
test-integration-mqtt = []
# Debian packaging.
[package.metadata.deb]
assets = [

View File

@ -42,3 +42,8 @@ test:
cargo fmt --check
cargo clippy --no-deps
cargo test
test-all:
cargo fmt --check
cargo clippy --no-deps
cargo test --features test-all-integrations

View File

@ -242,7 +242,7 @@ impl<'a> IntegrationTrait for Integration<'a> {
}
}
#[cfg(test)]
#[cfg(all(test, feature = "test-integration-amqp"))]
pub mod test {
use std::env;

View File

@ -221,7 +221,7 @@ impl<'a> IntegrationTrait for Integration<'a> {
}
}
#[cfg(test)]
#[cfg(all(test, feature = "test-integration-kafka"))]
pub mod test {
use std::env;

View File

@ -435,7 +435,7 @@ async fn message_callback(
}
}
#[cfg(test)]
#[cfg(all(test, feature = "test-integration-mqtt"))]
pub mod test {
use std::env;