Skip to content
Open
Changes from all 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
20 changes: 16 additions & 4 deletions tests/scripts/pulpcore/test_orphans.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,28 @@ set -eu
# shellcheck source=tests/scripts/config.source
. "$(dirname "$(dirname "$(realpath "$0")")")"/config.source

expect_succ pulp orphan cleanup
eval "$(pulp status | jq -r '.domain_enabled // false')" || exit 23

DOMAIN="cli_test_orphans"

cleanup() {
pulp domain destroy --name "$DOMAIN" || true
}
trap cleanup EXIT

# Setup test domain to avoid other tests
expect_succ pulp domain create --name "$DOMAIN" --storage-class "pulpcore.app.models.storage.FileSystem" --storage-settings '{"location": "/var/lib/pulp/media"}'

expect_succ pulp --domain "$DOMAIN" orphan cleanup

test "$(echo "${OUTPUT}" | jq -r '.state' )" = "completed"

pulp debug has-plugin --name "file" || exit 23

dd if=/dev/urandom of=test_1.txt bs=2MiB count=1

expect_succ pulp file content upload --file test_1.txt --relative-path orphan_test/test_1.txt
expect_succ pulp --domain "$DOMAIN" file content upload --file test_1.txt --relative-path orphan_test/test_1.txt
content_href=$(echo "${OUTPUT}" | jq -r .pulp_href)

expect_succ pulp orphan cleanup --content-hrefs "[\"$content_href\"]"
expect_succ pulp orphan cleanup --protection-time 10
expect_succ pulp --domain "$DOMAIN" orphan cleanup --content-hrefs "[\"$content_href\"]"
expect_succ pulp --domain "$DOMAIN" orphan cleanup --protection-time 10
Loading