test: cover collision and permission failures
This commit is contained in:
@@ -97,6 +97,15 @@ assert_qb() {
|
||||
--selected "$selected" >/dev/null
|
||||
}
|
||||
|
||||
archive2_download_mode=
|
||||
restore_archive2_download_mode() {
|
||||
if [[ -n "$archive2_download_mode" ]]; then
|
||||
compose_node archive-2 exec -T qbittorrent \
|
||||
chmod "$archive2_download_mode" /downloads >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
trap restore_archive2_download_mode EXIT
|
||||
|
||||
for node in cache-1 cache-2 archive-1 archive-2; do
|
||||
delete_torrent "$node" "$legacy_bundle_hash"
|
||||
delete_torrent "$node" "$bundle_hash"
|
||||
@@ -377,6 +386,35 @@ control_scenario expect-failure \
|
||||
assert_qb cache-1 "$cancel_hash" '0'
|
||||
delete_torrent archive-2 "$cancel_hash"
|
||||
|
||||
target_collision_job=$(control_scenario create-paused \
|
||||
--operation archive \
|
||||
--source-client cache-1 \
|
||||
--target-client archive-2 \
|
||||
--info-hash "$cancel_hash")
|
||||
compose_node archive-2 exec -T --user 1001:1001 qbittorrent /bin/sh -c \
|
||||
'printf "wrong-size\n" > /downloads/fixture.bin'
|
||||
control_scenario expect-failure \
|
||||
--job-id "$target_collision_job" \
|
||||
--contains 'pre-existing destination size does not match'
|
||||
assert_qb cache-1 "$cancel_hash" '0'
|
||||
compose_node archive-2 exec -T qbittorrent rm -f /downloads/fixture.bin
|
||||
|
||||
permission_job=$(control_scenario create-paused \
|
||||
--operation archive \
|
||||
--source-client cache-1 \
|
||||
--target-client archive-2 \
|
||||
--info-hash "$cancel_hash")
|
||||
archive2_download_mode=$(compose_node archive-2 exec -T qbittorrent \
|
||||
stat -c '%a' /downloads)
|
||||
compose_node archive-2 exec -T qbittorrent chmod 0555 /downloads
|
||||
control_scenario expect-failure \
|
||||
--job-id "$permission_job" \
|
||||
--contains 'Permission denied'
|
||||
restore_archive2_download_mode
|
||||
archive2_download_mode=
|
||||
assert_qb cache-1 "$cancel_hash" '0'
|
||||
|
||||
printf '%s\n' \
|
||||
'complex matrix passed: selective merges, union eviction, hostile retention,' \
|
||||
'queued/partial cancellation, restart/replay, and hostile state changes'
|
||||
'queued/partial cancellation, restart/replay, hostile state changes,' \
|
||||
'target collisions, and permission denial'
|
||||
|
||||
Reference in New Issue
Block a user