Skip to content

Commit 7cda303

Browse files
authored
integration: Bundle tests in src (#665)
Integration tests are split out so each is effectively its own build target. While this is convenient at times, it also means that compiling all integration tests is SLOW. By bundling them all into the integration/src, we avoid having to recompile/link the proxy many times when building integration tests.
1 parent d5c10bd commit 7cda303

File tree

13 files changed

+47
-73
lines changed

13 files changed

+47
-73
lines changed

.github/workflows/rust.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Rust PR
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77
pull_request: {}
88

99
jobs:
@@ -12,21 +12,20 @@ jobs:
1212
container:
1313
image: docker://rust:1.44.1-buster
1414
steps:
15-
- uses: actions/checkout@v1
16-
- run: rustup component add rustfmt
17-
- run: make check-fmt
15+
- uses: actions/checkout@v1
16+
- run: rustup component add rustfmt
17+
- run: make check-fmt
1818

19-
lib:
19+
check:
2020
runs-on: ubuntu-18.04
2121
container:
2222
image: docker://rust:1.44.1-buster
2323
steps:
24-
- uses: actions/checkout@v1
25-
- run: make test-lib
24+
- uses: actions/checkout@v1
25+
- run: make check
2626

27-
integration:
27+
test:
2828
runs-on: ubuntu-18.04
2929
steps:
30-
- uses: actions/checkout@v1
31-
- name: Test
32-
run: make test-integration
30+
- uses: actions/checkout@v1
31+
- run: make test

Makefile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ endif
6868
fetch: Cargo.lock
6969
$(CARGO) fetch --locked
7070

71+
.PHONY: check
72+
check: fetch
73+
$(CARGO) check
74+
7175
.PHONY: build
7276
build: $(TARGET_BIN)
7377

@@ -89,16 +93,9 @@ shellcheck:
8993
! -path "$(CURDIR)"/.git/hooks/\*.sample \
9094
| while read -r f; do [ "$$(file -b --mime-type "$$f")" = 'text/x-shellscript' ] && printf '%s\0' "$$f"; done | xargs -0)
9195

92-
.PHONY: test-lib
93-
test-lib:: fetch
94-
$(CARGO_TEST) --lib
95-
96-
.PHONY: test-integration
97-
test-integration: fetch
98-
$(CARGO_TEST) --tests
99-
10096
.PHONY: test
101-
test: test-lib test-integration
97+
test: fetch
98+
$(CARGO_TEST)
10299

103100
.PHONY: test-flakey
104101
test-flakey: fetch

linkerd/app/integration/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
mod test_env;
88

9+
#[cfg(test)]
10+
mod tests;
11+
912
pub use self::test_env::TestEnv;
1013
pub use bytes::{Buf, BufMut, Bytes};
1114
pub use futures::{future, FutureExt, TryFuture, TryFutureExt};

linkerd/app/integration/tests/discovery.rs renamed to linkerd/app/integration/src/tests/discovery.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#![deny(warnings, rust_2018_idioms)]
2-
#![type_length_limit = "16289823"]
3-
#![recursion_limit = "256"]
4-
5-
use linkerd2_app_integration::*;
1+
use crate::*;
62

73
macro_rules! generate_tests {
84
(server: $make_server:path, client: $make_client:path) => {
@@ -549,7 +545,7 @@ macro_rules! generate_tests {
549545
}
550546

551547
mod http2 {
552-
use linkerd2_app_integration::*;
548+
use crate::*;
553549

554550
generate_tests! { server: server::new, client: client::new }
555551

@@ -610,14 +606,14 @@ mod http2 {
610606
}
611607

612608
mod http1 {
613-
use linkerd2_app_integration::*;
609+
use crate::*;
614610

615611
generate_tests! {
616612
server: server::http1, client: client::http1
617613
}
618614

619615
mod absolute_uris {
620-
use linkerd2_app_integration::*;
616+
use crate::*;
621617

622618
generate_tests! {
623619
server: server::http1,

linkerd/app/integration/tests/identity.rs renamed to linkerd/app/integration/src/tests/identity.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#![deny(warnings, rust_2018_idioms)]
2-
#![type_length_limit = "16289823"]
3-
#![recursion_limit = "256"]
4-
5-
use linkerd2_app_integration::*;
1+
use crate::*;
62
use std::{
73
sync::{
84
atomic::{AtomicBool, Ordering},
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
mod discovery;
2+
mod identity;
3+
mod orig_proto;
4+
mod profile_dst_overrides;
5+
mod profiles;
6+
mod shutdown;
7+
mod tap;
8+
mod telemetry;
9+
mod transparency;

linkerd/app/integration/tests/orig_proto.rs renamed to linkerd/app/integration/src/tests/orig_proto.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#![deny(warnings, rust_2018_idioms)]
2-
#![type_length_limit = "16289823"]
3-
4-
use linkerd2_app_integration::*;
1+
use crate::*;
52

63
#[tokio::test]
74
async fn outbound_http1() {

linkerd/app/integration/tests/profile_dst_overrides.rs renamed to linkerd/app/integration/src/tests/profile_dst_overrides.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#![deny(warnings, rust_2018_idioms)]
2-
#![type_length_limit = "16289823"]
3-
#![recursion_limit = "256"]
4-
5-
use linkerd2_app_integration::*;
1+
use crate::*;
62
use linkerd2_proxy_api::destination as pb;
73
use std::sync::atomic::{AtomicUsize, Ordering};
84

linkerd/app/integration/tests/profiles.rs renamed to linkerd/app/integration/src/tests/profiles.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#![deny(warnings, rust_2018_idioms)]
2-
#![type_length_limit = "16289823"]
3-
#![recursion_limit = "256"]
4-
5-
use linkerd2_app_integration::*;
1+
use crate::*;
62
use std::sync::atomic::{AtomicUsize, Ordering};
73

84
macro_rules! profile_test {

linkerd/app/integration/tests/shutdown.rs renamed to linkerd/app/integration/src/tests/shutdown.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#![deny(warnings, rust_2018_idioms)]
2-
#![type_length_limit = "16289823"]
3-
#![recursion_limit = "256"]
4-
5-
use linkerd2_app_integration::*;
1+
use crate::*;
62

73
#[tokio::test]
84
async fn h2_goaways_connections() {

0 commit comments

Comments
 (0)