forked from pulp/pulp-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes pulp#100
- Loading branch information
David Davis
committed
Feb 2, 2021
1 parent
fe74ca3
commit e3ec72f
Showing
9 changed files
with
168 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added label subcommands (set and unset). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh | ||
|
||
# shellcheck source=tests/scripts/config.source | ||
. "$(dirname "$(realpath "$0")")/config.source" | ||
|
||
require_min_pulp "3.10.0" | ||
|
||
cleanup() { | ||
pulp file repository destroy --name "cli_test_file_repo" || true | ||
} | ||
trap cleanup EXIT | ||
|
||
name="cli_test_file_repo" | ||
expect_succ pulp file repository create --name "$name" | ||
expect_succ pulp file repository label set --name "$name" --key "atani" --value "hurin" | ||
expect_succ pulp file repository label set --name "$name" --key "ainur" --value "ulmo" | ||
|
||
expect_succ pulp file repository show --name "$name" | ||
test "$(echo "$OUTPUT" | jq -r -c .pulp_labels)" = '{"atani":"hurin","ainur":"ulmo"}' | ||
|
||
# update a label | ||
expect_succ pulp file repository label set --name "$name" --key "atani" --value "beor" | ||
expect_succ pulp file repository show --name "$name" | ||
test "$(echo "$OUTPUT" | jq -r -c .pulp_labels)" = '{"ainur":"ulmo","atani":"beor"}' | ||
expect_succ pulp file repository label show --name "$name" --key "atani" | ||
test "$OUTPUT" = "beor" | ||
|
||
# remove a label | ||
expect_succ pulp file repository label unset --name "$name" --key "atani" | ||
expect_succ pulp file repository show --name "$name" | ||
test "$(echo "$OUTPUT" | jq -r -c .pulp_labels)" = '{"ainur":"ulmo"}' | ||
expect_fail pulp file repository label show --name "$name" | ||
|
||
# filtering | ||
expect_succ pulp file repository list --label-select "ainur" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 1 | ||
expect_succ pulp file repository list --label-select "!ainur" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 0 | ||
expect_succ pulp file repository list --label-select "ainur=ulmo" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 1 | ||
expect_succ pulp file repository list --label-select "ainur!=ulmo" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 0 | ||
expect_succ pulp file repository list --label-select "ainur~lm" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 1 | ||
|
||
expect_succ pulp file repository label set --name "$name" --key "istar" --value "olorin" | ||
expect_succ pulp file repository list --label-select "ainur=ulmo,istar!=curumo" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 1 | ||
expect_succ pulp file repository list --label-select "ainur=ulmo,istar=olorin" | ||
test "$(echo "$OUTPUT" | jq length)" -eq 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters