From b31540c4653491818f1e39c5ae147a1add2d3fb8 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 8 Sep 2023 15:33:04 +0200 Subject: [PATCH 1/7] feat: test collapsing of error --- crates/rattler_solve/tests/backends.rs | 15 +++++++++++++++ test-data/channels/dummy/linux-64/repodata.json | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/rattler_solve/tests/backends.rs b/crates/rattler_solve/tests/backends.rs index 67b486d60..4d5b1beca 100644 --- a/crates/rattler_solve/tests/backends.rs +++ b/crates/rattler_solve/tests/backends.rs @@ -187,6 +187,21 @@ macro_rules! solver_backend_tests { insta::assert_yaml_snapshot!(solve_real_world::<$T>(vec!["python=3.9"])); } + #[test] + fn test_solve_with_error() { + let result = solve::<$T>( + dummy_channel_json_path(), + Vec::new(), + Vec::new(), + &["foobar >=2", "bors >= 2"], + ); + + assert!(result.is_err()); + + let err = result.err().unwrap(); + insta::assert_debug_snapshot!(err); + } + #[test] fn test_solve_dummy_repo_install_non_existent() { let result = solve::<$T>( diff --git a/test-data/channels/dummy/linux-64/repodata.json b/test-data/channels/dummy/linux-64/repodata.json index 7d5f059a3..e019fd1cc 100644 --- a/test-data/channels/dummy/linux-64/repodata.json +++ b/test-data/channels/dummy/linux-64/repodata.json @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a8b4ace3d680d33498f54cb36d5f4c5234bac3929f72dff6858888bc02b13148 -size 2417 +oid sha256:a69c4d9a9e64a8af04955d4de0684881d7094630f995cdc902294cbfe4463013 +size 5516 From ce8a99d19f913871aa97be30db69db4c953af3d1 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 8 Sep 2023 15:33:40 +0200 Subject: [PATCH 2/7] fix: added snaps --- .../snapshots/backends__libsolv_c__solve_with_error.snap | 9 +++++++++ .../backends__libsolv_rs__solve_with_error.snap | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap create mode 100644 crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap diff --git a/crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap b/crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap new file mode 100644 index 000000000..4d7e2b18f --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap @@ -0,0 +1,9 @@ +--- +source: crates/rattler_solve/tests/backends.rs +expression: err +--- +Unsolvable( + [ + "package foobar-2.0-bla_1 requires bors <2.0, but none of the providers can be installed", + ], +) diff --git a/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap new file mode 100644 index 000000000..47aa90df4 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap @@ -0,0 +1,9 @@ +--- +source: crates/rattler_solve/tests/backends.rs +expression: err +--- +Unsolvable( + [ + "The following packages are incompatible\n|-- bors >=2 can be installed with any of the following options:\n |-- bors 2.1\n |-- bors 2.0\n|-- foobar >=2 cannot be installed because there are no viable options:\n |-- foobar 2.0 would require\n |-- bors <2.0, which cannot be installed because there are no viable options:\n |-- bors 1.0 | 1.1 | 1.2.1, which conflicts with the versions reported above.\n", + ], +) From 8e0ca6f0a043d2d37bf028841227339268166da6 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 8 Sep 2023 15:45:47 +0200 Subject: [PATCH 3/7] test: new repodata --- ...__repo_data__test__serialize_packages.snap | 94 ++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap index 762c3378c..7b87b3870 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap @@ -27,12 +27,90 @@ packages: license: MIT license_family: MIT md5: bc13aa58e2092bcb0b97c561373d3905 - name: bar + name: baz sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a size: 414494 subdir: linux-64 timestamp: 1605110689658 version: 1.2.3 + "baz-2.0-unix_py36h1af98f8_2\u0000.tar.bz2": + build: "unix_py36h1af98f8_2\u0000" + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: baz + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.0" + bors-1.0-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "1.0" + bors-1.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "1.1" + bors-1.2.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: 1.2.1 + bors-2.0-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.0" + bors-2.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.1" foo-3.0.2-py36h1af98f8_1.conda: build: py36h1af98f8_1 build_number: 1 @@ -72,6 +150,20 @@ packages: subdir: linux-64 timestamp: 1605110689658 version: 4.0.2 + foobar-2.0-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: + - bors <2.0 + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: foobar + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.0" packages.conda: {} repodata_version: 1 From f47f3af52f0c8dab10cefa7f5cc85663ef7000f5 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Mon, 11 Sep 2023 09:57:07 +0200 Subject: [PATCH 4/7] fix: accept test --- ...repo_data__test__serialize_packages-2.snap | 102 +++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap index e3e4b3c2d..0ff562e5d 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap @@ -32,13 +32,97 @@ expression: json "license": "MIT", "license_family": "MIT", "md5": "bc13aa58e2092bcb0b97c561373d3905", - "name": "bar", + "name": "baz", "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", "size": 414494, "subdir": "linux-64", "timestamp": 1605110689658, "version": "1.2.3" }, + "baz-2.0-unix_py36h1af98f8_2\u0000.tar.bz2": { + "build": "unix_py36h1af98f8_2\u0000", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "baz", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.0" + }, + "bors-1.0-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "1.0" + }, + "bors-1.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "1.1" + }, + "bors-1.2.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "1.2.1" + }, + "bors-2.0-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.0" + }, + "bors-2.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.1" + }, "foo-3.0.2-py36h1af98f8_1.conda": { "build": "py36h1af98f8_1", "build_number": 1, @@ -80,6 +164,22 @@ expression: json "subdir": "linux-64", "timestamp": 1605110689658, "version": "4.0.2" + }, + "foobar-2.0-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [ + "bors <2.0" + ], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "foobar", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.0" } }, "packages.conda": {}, From 37aa151c1adda1249bd0cf4589b345e603144eff Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Mon, 11 Sep 2023 14:05:32 +0200 Subject: [PATCH 5/7] feat: added new snap --- .../tests/snapshots/backends__libsolv_rs__solve_with_error.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap index 47aa90df4..bca6622e5 100644 --- a/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap +++ b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap @@ -4,6 +4,6 @@ expression: err --- Unsolvable( [ - "The following packages are incompatible\n|-- bors >=2 can be installed with any of the following options:\n |-- bors 2.1\n |-- bors 2.0\n|-- foobar >=2 cannot be installed because there are no viable options:\n |-- foobar 2.0 would require\n |-- bors <2.0, which cannot be installed because there are no viable options:\n |-- bors 1.0 | 1.1 | 1.2.1, which conflicts with the versions reported above.\n", + "The following packages are incompatible\n|-- foobar >=2 can be installed with any of the following options:\n |-- foobar 2.0 would require\n |-- bors <2.0, which can be installed with any of the following options:\n |-- bors 1.2.1\n|-- bors >=2 cannot be installed because there are no viable options:\n |-- bors 2.1, which conflicts with the versions reported above.\n |-- bors 2.0, which conflicts with the versions reported above.\n", ], ) From 19618c8ba5426964b50db01555c9208faad64099 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Mon, 11 Sep 2023 14:33:48 +0200 Subject: [PATCH 6/7] feat: new repodata for errors --- ...s__repo_data__test__serialize_packages-2.snap | 16 ++++++++++++++++ ...pes__repo_data__test__serialize_packages.snap | 14 ++++++++++++++ .../backends__libsolv_rs__solve_with_error.snap | 2 +- test-data/channels/dummy/linux-64/repodata.json | 4 ++-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap index 0ff562e5d..336802a6e 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap @@ -180,6 +180,22 @@ expression: json "subdir": "linux-64", "timestamp": 1605110689658, "version": "2.0" + }, + "foobar-2.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [ + "bors <2.0" + ], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "foobar", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.1" } }, "packages.conda": {}, diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap index 7b87b3870..d4e0fa4f2 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap @@ -164,6 +164,20 @@ packages: subdir: linux-64 timestamp: 1605110689658 version: "2.0" + foobar-2.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: + - bors <2.0 + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: foobar + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.1" packages.conda: {} repodata_version: 1 diff --git a/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap index bca6622e5..7fab49982 100644 --- a/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap +++ b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap @@ -4,6 +4,6 @@ expression: err --- Unsolvable( [ - "The following packages are incompatible\n|-- foobar >=2 can be installed with any of the following options:\n |-- foobar 2.0 would require\n |-- bors <2.0, which can be installed with any of the following options:\n |-- bors 1.2.1\n|-- bors >=2 cannot be installed because there are no viable options:\n |-- bors 2.1, which conflicts with the versions reported above.\n |-- bors 2.0, which conflicts with the versions reported above.\n", + "The following packages are incompatible\n|-- foobar >=2 can be installed with any of the following options:\n |-- foobar 2.0 | 2.1 would require\n |-- bors <2.0, which can be installed with any of the following options:\n |-- bors 1.2.1\n|-- bors >=2 cannot be installed because there are no viable options:\n |-- bors 2.1, which conflicts with the versions reported above.\n |-- bors 2.0, which conflicts with the versions reported above.\n", ], ) diff --git a/test-data/channels/dummy/linux-64/repodata.json b/test-data/channels/dummy/linux-64/repodata.json index e019fd1cc..cc85fb43c 100644 --- a/test-data/channels/dummy/linux-64/repodata.json +++ b/test-data/channels/dummy/linux-64/repodata.json @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a69c4d9a9e64a8af04955d4de0684881d7094630f995cdc902294cbfe4463013 -size 5516 +oid sha256:9e6c2f615236d39ea28c98ecb1e64ef204a73cd47748d44ed9aa157452981aa4 +size 5973 From 7f398246d829995426bd599756fe6bb7104c1111 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Mon, 11 Sep 2023 15:18:48 +0200 Subject: [PATCH 7/7] fix: bring back the changes to move to repodata.json version 2 --- ...a_types__repo_data__test__base_url_packages.snap | 13 ++++++++++--- test-data/channels/dummy/linux-64/repodata.json | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap index 4aa817cf6..83b625117 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap @@ -1,11 +1,18 @@ --- source: crates/rattler_conda_types/src/repo_data/mod.rs -assertion_line: 493 expression: file_urls --- -- channels/dummy/linux-64/foo-3.0.2-py36h1af98f8_1.tar.bz2 +- "channels/dummy/linux-64/baz-2.0-unix_py36h1af98f8_2\u0000.tar.bz2" - "channels/dummy/linux-64/baz-1.0-unix_py36h1af98f8_2\u0000.tar.bz2" -- channels/dummy/linux-64/foo-4.0.2-py36h1af98f8_2.tar.bz2 +- channels/dummy/linux-64/bors-2.1-bla_1.tar.bz2 - channels/dummy/linux-64/bar-1.0-unix_py36h1af98f8_2.tar.bz2 +- channels/dummy/linux-64/bors-1.0-bla_1.tar.bz2 - channels/dummy/linux-64/foo-3.0.2-py36h1af98f8_1.conda +- channels/dummy/linux-64/foo-3.0.2-py36h1af98f8_1.tar.bz2 +- channels/dummy/linux-64/bors-1.1-bla_1.tar.bz2 +- channels/dummy/linux-64/foo-4.0.2-py36h1af98f8_2.tar.bz2 +- channels/dummy/linux-64/bors-2.0-bla_1.tar.bz2 +- channels/dummy/linux-64/foobar-2.0-bla_1.tar.bz2 +- channels/dummy/linux-64/foobar-2.1-bla_1.tar.bz2 +- channels/dummy/linux-64/bors-1.2.1-bla_1.tar.bz2 diff --git a/test-data/channels/dummy/linux-64/repodata.json b/test-data/channels/dummy/linux-64/repodata.json index baaf6cdc5..9e6b4d306 100644 --- a/test-data/channels/dummy/linux-64/repodata.json +++ b/test-data/channels/dummy/linux-64/repodata.json @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e6c2f615236d39ea28c98ecb1e64ef204a73cd47748d44ed9aa157452981aa4 -size 5973 \ No newline at end of file +oid sha256:adf739ba7312a1c7a179b7e9017e8b15e66a1dc08e4151ecca0c88a4f5d7131c +size 6004