From 49e7411c16784e1c39fae71d4947e73b361790ca Mon Sep 17 00:00:00 2001 From: Sumanth <33193748+sumanth-manchala@users.noreply.github.com> Date: Thu, 11 Jan 2024 01:14:29 +0530 Subject: [PATCH] test: adds failing apache-airflow test (#10) Relates to https://github.com/prefix-dev/rip/issues/75 --------- Co-authored-by: Bas Zalmstra --- Cargo.toml | 2 +- tests/solver.rs | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 96df522..d5a72b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,4 +23,4 @@ serde = { version = "1.0", features = ["derive"], optional = true } insta = "1.31.0" indexmap = "2.0.0" proptest = "1.2.0" -tracing-test = "0.2.4" +tracing-test = { version = "0.2.4", features = ["no-env-filter"] } diff --git a/tests/solver.rs b/tests/solver.rs index 01a0384..b44a317 100644 --- a/tests/solver.rs +++ b/tests/solver.rs @@ -456,6 +456,43 @@ fn test_resolve_with_nonexisting() { assert_eq!(solvable.inner().0, 3); } +#[test] +#[traced_test] +#[should_panic] // TODO: Should be fixed, https://github.com/prefix-dev/rip/issues/75 +fn test_resolve_with_nested_deps() { + let provider = BundleBoxProvider::from_packages(&[ + ( + "apache-airflow", + 3, + vec!["opentelemetry-api 2..4", "opentelemetry-exporter-otlp"], + ), + ( + "apache-airflow", + 2, + vec!["opentelemetry-api 2..4", "opentelemetry-exporter-otlp"], + ), + ("apache-airflow", 1, vec![]), + ("opentelemetry-api", 3, vec!["opentelemetry-sdk"]), + ("opentelemetry-api", 2, vec![]), + ("opentelemetry-api", 1, vec![]), + ("opentelemetry-exporter-otlp", 1, vec!["opentelemetry-grpc"]), + ("opentelemetry-grpc", 1, vec!["opentelemetry-api 1"]), + ]); + let requirements = provider.requirements(&["apache-airflow"]); + let mut solver = Solver::new(provider); + let solved = solver.solve(requirements).unwrap(); + + assert_eq!(solved.len(), 1); + + let solvable = solver.pool().resolve_solvable(solved[0]); + + assert_eq!( + solver.pool().resolve_package_name(solvable.name_id()), + "apache-airflow" + ); + assert_eq!(solvable.inner().0, 1); +} + /// Locking a specific package version in this case a lower version namely `3` should result /// in the higher package not being considered #[test]