diff --git a/master_changes.md b/master_changes.md index 024eadbeb77..069cf54909b 100644 --- a/master_changes.md +++ b/master_changes.md @@ -118,6 +118,7 @@ users) * pin: add a test for erroneous first fetch done as local path on local VCS pinned packages [#6221 @rjbou] * Add cache test for installed packages cache update after an action failure [#6213 @kit-ty-kate @rjbou] * Add more tests for lint W59 [#6219 @rjbou] + * Add admin filter subcommand test [#6166 @rjbou] ### Engine * Update print file function [#6233 @rjbou] diff --git a/tests/reftests/admin.test b/tests/reftests/admin.test index 558c2c0fb82..3e0fb49a260 100644 --- a/tests/reftests/admin.test +++ b/tests/reftests/admin.test @@ -654,9 +654,84 @@ opam-version: "2.0" ### :::::::::::::::::::::::::::::::::::::::::::::::::::::: ### :: Cache is tested in admin-cache.test :: ### :::::::::::::::::::::::::::::::::::::::::::::::::::::: -### : +### :::::::::::::: +### :VII: Filter : +### :::::::::::::: +### rm -rf packages +### +opam-version: "2.0" +available: [ os = "linux" ] +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +depends: [ "lorem" | "adipscing" ] +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +available: [ os = "win32" ] +### +opam-version: "2.0" +available: false +### mv REPO/packages . +### opam admin list +# Packages matching: available +# Name # Installed # Synopsis +adipscing -- +amet -- +consectetur -- +dolor -- +ipsum -- +lorem -- +sit -- +### opam admin filter --dry-run 'a*' +The following 2 packages will be kept in the repository (6 packages will be REMOVED): +adipscing.1 amet.1 +rm -rf ${BASEDIR}/packages/consectetur/consectetur.1 +rm -rf ${BASEDIR}/packages/dolor/dolor.1 +rm -rf ${BASEDIR}/packages/elit/elit.1 +rm -rf ${BASEDIR}/packages/ipsum/ipsum.1 +rm -rf ${BASEDIR}/packages/lorem/lorem.1 +rm -rf ${BASEDIR}/packages/sit/sit.1 +### opam admin filter --dry-run 'a*' --remove +The following 2 packages will be REMOVED from the repository (6 packages will be kept): +adipscing.1 amet.1 +rm -rf ${BASEDIR}/packages/adipscing/adipscing.1 +rm -rf ${BASEDIR}/packages/amet/amet.1 +### opam admin filter --dry-run --available +The following 7 packages will be kept in the repository (1 packages will be REMOVED): +adipscing.1 amet.1 consectetur.1 dolor.1 ipsum.1 lorem.1 sit.1 +rm -rf ${BASEDIR}/packages/elit/elit.1 +### opam admin filter --dry-run --resolve sit --environment 'os=win32' +The following 2 packages will be kept in the repository (6 packages will be REMOVED): +adipscing.1 sit.1 +rm -rf ${BASEDIR}/packages/amet/amet.1 +rm -rf ${BASEDIR}/packages/consectetur/consectetur.1 +rm -rf ${BASEDIR}/packages/dolor/dolor.1 +rm -rf ${BASEDIR}/packages/elit/elit.1 +rm -rf ${BASEDIR}/packages/ipsum/ipsum.1 +rm -rf ${BASEDIR}/packages/lorem/lorem.1 +### opam admin filter --dry-run --resolve sit --environment 'os=linux' +The following 2 packages will be kept in the repository (6 packages will be REMOVED): +lorem.1 sit.1 +rm -rf ${BASEDIR}/packages/adipscing/adipscing.1 +rm -rf ${BASEDIR}/packages/amet/amet.1 +rm -rf ${BASEDIR}/packages/consectetur/consectetur.1 +rm -rf ${BASEDIR}/packages/dolor/dolor.1 +rm -rf ${BASEDIR}/packages/elit/elit.1 +rm -rf ${BASEDIR}/packages/ipsum/ipsum.1 +### opam admin filter --dry-run --available --environment 'os=linux' +The following 6 packages will be kept in the repository (2 packages will be REMOVED): +amet.1 consectetur.1 dolor.1 ipsum.1 lorem.1 sit.1 +rm -rf ${BASEDIR}/packages/adipscing/adipscing.1 +rm -rf ${BASEDIR}/packages/elit/elit.1 ### :::::::::::::::::::::: -### :VII: Specific cases : +### :C: Specific cases : ### :::::::::::::::::::::: ### : Package version comparison error (#5334) ###