Add flaky_tests feature for skipping some tests on CI (#441)

This PR adds a `flaky_tests` cargo feature to control whether or not to ignore tests that are timing-dependent. This feature is enabled by default in local builds, but disabled on CI and in all Docker builds.

Closes #440
This commit is contained in:
Eliza Weisman 2018-02-26 10:17:53 -08:00 committed by GitHub
parent 893bacf8d6
commit 6309741ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -4,6 +4,11 @@ version = "0.3.0"
authors = ["Oliver Gould <ver@buoyant.io>"] authors = ["Oliver Gould <ver@buoyant.io>"]
publish = false publish = false
[features]
default = ["flaky_tests"]
# Disable to skip certain tests that should not be run on CI.
flaky_tests = []
[dependencies] [dependencies]
convert = { path = "./convert" } convert = { path = "./convert" }
conduit-proxy-controller-grpc = { path = "./controller-grpc" } conduit-proxy-controller-grpc = { path = "./controller-grpc" }

View File

@ -59,8 +59,8 @@ ARG PROXY_SKIP_TESTS
RUN if [ -n "$PROXY_SKIP_TESTS" ]; \ RUN if [ -n "$PROXY_SKIP_TESTS" ]; \
then echo "tests skipped" ; \ then echo "tests skipped" ; \
elif [ -n "$PROXY_UNOPTIMIZED" ]; \ elif [ -n "$PROXY_UNOPTIMIZED" ]; \
then cargo test -p conduit-proxy --frozen ; \ then cargo test -p conduit-proxy --frozen --no-default-features ; \
else cargo test -p conduit-proxy --frozen --release ; \ else cargo test -p conduit-proxy --frozen --release --no-default-features ; \
fi fi
RUN if [ -n "$PROXY_UNOPTIMIZED" ]; \ RUN if [ -n "$PROXY_UNOPTIMIZED" ]; \
then mv target/debug/conduit-proxy target/conduit-proxy ; \ then mv target/debug/conduit-proxy target/conduit-proxy ; \

View File

@ -177,12 +177,12 @@ fn inbound_aggregates_telemetry_over_several_requests() {
} }
// Ignore this test for now, because our method of adding latency to requests // Ignore this test on CI, because our method of adding latency to requests
// (calling `thread::sleep`) is likely to be flakey, especially on CI. // (calling `thread::sleep`) is likely to be flakey on Travis.
// Eventually, we can add some kind of mock timer system for simulating latency // Eventually, we can add some kind of mock timer system for simulating latency
// more reliably, and re-enable this test. // more reliably, and re-enable this test.
#[test] #[test]
#[ignore] #[cfg_attr(not(feature = "flaky_tests"), ignore)]
fn records_latency_statistics() { fn records_latency_statistics() {
let _ = env_logger::init(); let _ = env_logger::init();