Skip to content

Commit 752fc47

Browse files
authored
chore: Try out nextest in CI (#11692)
* chore: Try out nextest in CI Starting with flakey test retries. Signed-off-by: Jesse Szwedko <[email protected]> * Split up benches and non-benches tests `nextest` doesn't work with criterion benches: nextest-rs/nextest#96 Signed-off-by: Jesse Szwedko <[email protected]> * Avoid testing benches with nextest Since criterion doesn't support the flags mentioned on https://nexte.st/book/custom-test-harnesses.html Signed-off-by: Jesse Szwedko <[email protected]> * Fix cargo nextest installation Signed-off-by: Jesse Szwedko <[email protected]> * Run docs tests too since nextest doesn't support them Signed-off-by: Jesse Szwedko <[email protected]> * Fix docs test Signed-off-by: Jesse Szwedko <[email protected]> * Don't test benches since there isn't a way to test just them Signed-off-by: Jesse Szwedko <[email protected]> * Install nextest for Windows Signed-off-by: Jesse Szwedko <[email protected]> * Fix CLI test running Signed-off-by: Jesse Szwedko <[email protected]>
1 parent b6edb02 commit 752fc47

File tree

11 files changed

+25
-17
lines changed

11 files changed

+25
-17
lines changed

.config/nextest.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[profile.default]
2+
retries = 3

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ jobs:
157157
- run: make test-cli
158158
- run: make test-behavior
159159
- run: make check-examples
160+
- run: make test-docs
160161
- name: Stop sccache
161162
run: sccache --stop-server
162163

Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -818,44 +818,37 @@ enrichment-tables-benches = ["enrichment-tables-file"]
818818
[[bench]]
819819
name = "default"
820820
harness = false
821-
test = true
822821
required-features = ["benches"]
823822

824823
[[bench]]
825824
name = "dnstap"
826825
path = "benches/dnstap/mod.rs"
827826
harness = false
828-
test = true
829827
required-features = ["dnstap-benches"]
830828

831829
[[bench]]
832830
name = "remap"
833831
harness = false
834-
test = true
835832
required-features = ["remap-benches"]
836833

837834
[[bench]]
838835
name = "enrichment_tables_file"
839836
harness = false
840-
test = true
841837
required-features = ["enrichment-tables-benches"]
842838

843839
[[bench]]
844840
name = "languages"
845841
harness = false
846-
test = true
847842
required-features = ["language-benches"]
848843

849844
[[bench]]
850845
name = "loki"
851846
harness = false
852-
test = true
853847
required-features = ["loki-benches"]
854848

855849
[[bench]]
856850
name = "distribution_statistic"
857851
harness = false
858-
test = true
859852
required-features = ["statistic-benches"]
860853

861854
[[bench]]
@@ -869,5 +862,4 @@ required-features = ["transform-benches"]
869862
name = "codecs"
870863
path = "benches/codecs/main.rs"
871864
harness = false
872-
test = false
873865
required-features = ["codecs-benches"]

Makefile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,27 @@ target/%/vector.tar.gz: target/%/vector CARGO_HANDLES_FRESHNESS
283283

284284
##@ Testing (Supports `ENVIRONMENT=true`)
285285

286+
# nextest doesn't support running doc tests yet so this is split out as
287+
# `test-docs`
288+
# https://github.com/nextest-rs/nextest/issues/16
289+
#
290+
# criterion doesn't support the flags needed by nextest to run so these are left
291+
# out for now
292+
# https://github.com/bheisler/criterion.rs/issues/562
293+
#
294+
# `cargo test` lacks support for testing _just_ benches otherwise we'd have
295+
# a target for that
296+
# https://github.com/rust-lang/cargo/issues/6454
286297
.PHONY: test
287298
test: ## Run the unit test suite
288-
${MAYBE_ENVIRONMENT_EXEC} cargo test --workspace --no-fail-fast --no-default-features --features "${DEFAULT_FEATURES} metrics-benches codecs-benches language-benches remap-benches statistic-benches ${DNSTAP_BENCHES} benches" ${SCOPE}
299+
${MAYBE_ENVIRONMENT_EXEC} cargo nextest run --workspace --no-fail-fast --no-default-features --features "${DEFAULT_FEATURES}" ${SCOPE}
300+
301+
.PHONY: test-docs
302+
test-docs: ## Run the docs test suite
303+
${MAYBE_ENVIRONMENT_EXEC} cargo test --doc --workspace --no-fail-fast --no-default-features --features "${DEFAULT_FEATURES}" ${SCOPE}
289304

290305
.PHONY: test-all
291-
test-all: test test-behavior test-integration ## Runs all tests, unit, behaviorial, and integration.
306+
test-all: test test-docs test-behavior test-integration ## Runs all tests: unit, docs, behaviorial, and integration.
292307

293308
.PHONY: test-x86_64-unknown-linux-gnu
294309
test-x86_64-unknown-linux-gnu: cross-test-x86_64-unknown-linux-gnu ## Runs unit tests on the x86_64-unknown-linux-gnu triple
@@ -330,7 +345,7 @@ ifeq ($(AUTOSPAWN), true)
330345
@scripts/setup_integration_env.sh nats start
331346
sleep 10 # Many services are very slow... Give them a sec..
332347
endif
333-
${MAYBE_ENVIRONMENT_EXEC} cargo test --no-fail-fast --no-default-features --features nats-integration-tests --lib ::nats::
348+
${MAYBE_ENVIRONMENT_EXEC} cargo nextest run --no-fail-fast --no-default-features --features nats-integration-tests --lib ::nats::
334349
ifeq ($(AUTODESPAWN), true)
335350
@scripts/setup_integration_env.sh nats stop
336351
endif
@@ -369,7 +384,7 @@ test-shutdown-cleanup:
369384

370385
.PHONY: test-cli
371386
test-cli: ## Runs cli tests
372-
${MAYBE_ENVIRONMENT_EXEC} cargo test --no-fail-fast --no-default-features --features cli-tests --test cli -- --test-threads 4
387+
${MAYBE_ENVIRONMENT_EXEC} cargo nextest run --no-fail-fast --no-default-features --features cli-tests --test cli --test-threads 4
373388

374389
##@ Benching (Supports `ENVIRONMENT=true`)
375390

lib/file-source/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,3 @@ pretty_assertions = "1.1.0"
7979
[[bench]]
8080
name = "buffer"
8181
harness = false
82-
test = true

lib/tracing-limit/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ tracing-subscriber = { version = "0.3.9", default-features = false, features = [
2121
[[bench]]
2222
name = "limit"
2323
harness = false
24-
test = true

lib/vrl/compiler/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ vector_common = { path = "../../vector-common", default-features = false, featur
3535
[[bench]]
3636
name = "kind"
3737
harness = false
38-
test = true
3938

4039
[features]
4140
test = []

lib/vrl/stdlib/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,4 @@ bench = false
303303
[[bench]]
304304
name = "benches"
305305
harness = false
306-
test = true
307306
required-features = ["default"]

lib/vrl/vrl/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ vrl-stdlib = { path = "../stdlib" }
2525
[[bench]]
2626
name = "vm"
2727
harness = false
28-
test = true

scripts/environment/bootstrap-windows-2019.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ if ($env:CI -ne $null) {
55
} else {
66
$env:Path += ";$HOME\.cargo\bin"
77
}
8+
9+
rustup run stable cargo install cargo-nextest --version 0.9.8

scripts/environment/prepare.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ rustup show # causes installation of version from rust-toolchain.toml
55
rustup default "$(rustup show active-toolchain | awk '{print $1;}')"
66
rustup run stable cargo install cargo-deb --version 1.29.2
77
rustup run stable cargo install cross --version 0.2.1
8+
rustup run stable cargo install cargo-nextest --version 0.9.8
89

910
cd scripts
1011
bundle install

0 commit comments

Comments
 (0)