Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test refactor proposal #909

Merged
merged 22 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
#

[workspace]
members = [".", "./macros", "./agones", "./proto-gen"]
members = [".", "./macros", "./agones", "./proto-gen", "./test"]

[workspace.dependencies]
base64 = "0.21.0"
kube = { version = "0.88", features = [
"runtime",
"rustls-tls",
Expand All @@ -27,6 +28,10 @@ kube-core = { version = "0.88", default-features = false, features = [
"schema",
] }
k8s-openapi = { version = "0.21", features = ["v1_29", "schemars"] }
futures = "0.3.28"
quilkin = { path = "." }
rand = "0.8.5"
serde_json = "1.0.107"
tokio = { version = "1.32.0", features = [
"rt-multi-thread",
"fs",
Expand All @@ -35,9 +40,8 @@ tokio = { version = "1.32.0", features = [
"parking_lot",
"tracing",
] }
base64 = "0.21.0"
tempfile = "3.8.0"
tracing = "0.1.37"
futures = "0.3.28"

[package]
name = "quilkin"
Expand Down Expand Up @@ -110,12 +114,12 @@ parking_lot = "0.12.1"
prometheus = { version = "0.13.3", default-features = false }
prost = "0.12.1"
prost-types = "0.12.1"
rand = "0.8.5"
rand.workspace = true
regex = "1.9.6"
schemars = { version = "0.8.15", features = ["bytes", "url"] }
seahash = "4.1"
serde = { version = "1.0.188", features = ["derive", "rc"] }
serde_json = "1.0.107"
serde_json.workspace = true
serde_regex = "1.1.0"
serde_stacker = "0.1.10"
serde_yaml = "0.9.25"
Expand All @@ -124,7 +128,7 @@ socket2 = { version = "0.5.4", features = ["all"] }
stable-eyre = "0.2.2"
thiserror = "1.0.49"
tokio.workspace = true
tokio-stream = { version = "0.1.14", features = ["sync"] }
tokio-stream = { version = "0.1.14", features = ["net", "sync"] }
tonic = "0.10.2"
tracing.workspace = true
tracing-futures = { version = "0.2.5", features = ["futures-03"] }
Expand Down Expand Up @@ -161,7 +165,7 @@ pretty_assertions = "1.4.0"
rand = "0.8.5"
regex = "1.9.6"
tracing-test = "0.2.4"
tempfile = "3.8.0"
tempfile.workspace = true
xxhash-rust = { version = "0.8", features = ["xxh3"] }

[build-dependencies]
Expand Down
10 changes: 6 additions & 4 deletions benches/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl QuilkinLoop {

let thread = spawn("quilkin", move || {
let runtime = tokio::runtime::Runtime::new().unwrap();
let config = Arc::new(quilkin::Config::default());
let config = Arc::new(quilkin::Config::default_non_agent());
config.clusters.modify(|clusters| {
clusters
.insert_default([quilkin::net::endpoint::Endpoint::new(endpoint.into())].into())
Expand All @@ -334,15 +334,17 @@ impl QuilkinLoop {
port,
qcmp_port: runtime
.block_on(quilkin::test::available_addr(
&quilkin::test::AddressType::Random,
quilkin::test::AddressType::Random,
))
.port(),
..<_>::default()
};

runtime.block_on(async move {
let admin = quilkin::cli::Admin::Proxy(<_>::default());
proxy.run(config, admin, None, shutdown_rx).await.unwrap();
proxy
.run(config, Default::default(), None, shutdown_rx)
.await
.unwrap();
});
});

Expand Down
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test-quilkin: ensure-build-image
# --network=host because docker containers are not great at ipv6.
docker run --rm $(common_rust_args) \
--network=host \
-e RUST_BACKTRACE=1 --entrypoint=cargo $(BUILD_IMAGE_TAG) test
-e RUST_BACKTRACE=1 --entrypoint=cargo $(BUILD_IMAGE_TAG) test -p quilkin -p qt

# Run tests against the examples
test-examples: ensure-build-image
Expand Down
8 changes: 4 additions & 4 deletions examples/quilkin-filter-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async fn main() -> quilkin::Result<()> {

let (_shutdown_tx, shutdown_rx) = quilkin::make_shutdown_channel(quilkin::ShutdownKind::Normal);
let proxy = quilkin::Proxy::default();
let config = quilkin::Config::default();
let config = quilkin::Config::default_non_agent();
config.filters.store(std::sync::Arc::new(
quilkin::filters::FilterChain::try_create([quilkin::config::Filter {
name: Greet::NAME.into(),
Expand All @@ -109,8 +109,8 @@ async fn main() -> quilkin::Result<()> {
)
});

let admin = quilkin::cli::Admin::Proxy(<_>::default());

proxy.run(config.into(), admin, None, shutdown_rx).await
proxy
.run(config.into(), Default::default(), None, shutdown_rx)
.await
}
// ANCHOR_END: run
Loading