fix: support v2 and hybrid qBittorrent identities

This commit is contained in:
2026-07-23 11:48:08 +00:00
parent 69709c778b
commit 6ca94a546e
10 changed files with 240 additions and 74 deletions
+35 -17
View File
@@ -3,12 +3,13 @@ set -euo pipefail
source "$(dirname "$0")/lib.sh"
v2_hash=8650a1a074039673ce156d4fdede8e38051108ddc90936eea818a20be2de5bfc
v2_hash=3a22a96fa77fb2617b98ea276c8d720d2b82b97a1a463e843d38c9def4f814fa
v2_qb_prefix=${v2_hash:0:40}
v2_torrent=ZDQ6aW5mb2Q5OmZpbGUgdHJlZWQwOmQ2Omxlbmd0aGkxOGUxMTpwaWVjZXMgcm9vdDMyOkzwzP0tijSmHJ/EFMYDoUaQHYtd6SNXTmo3yoKC8M+SZWUxMjptZXRhIHZlcnNpb25pMmU0Om5hbWU2OnYyLmJpbjEyOnBpZWNlIGxlbmd0aGkxNjM4NGVlZQ==
hybrid_v1=b77eea6da964b9661e082d567218ddf26609af56
hybrid_v2=a7ca521665677a5bdace1bd4be32dbe0e43e25a3c578bb5e98efc76fb2bd9eeb
hybrid_torrent=ZDQ6aW5mb2Q5OmZpbGUgdHJlZWQwOmQ2Omxlbmd0aGkyMmUxMTpwaWVjZXMgcm9vdDMyOnAzSygNaQ3iIRKqDJWOXW4HIsea/KNFhE1SN+3/qvJSZWU2Omxlbmd0aGkyMmUxMjptZXRhIHZlcnNpb25pMmU0Om5hbWUxMDpoeWJyaWQuYmluMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6cGllY2VzMjA6xQCrcqTOQ+LNUqZJC7p47gKZ/GhlZQ==
v2_torrent=ZDQ6aW5mb2Q5OmZpbGUgdHJlZWQ2OnYyLmJpbmQwOmQ2Omxlbmd0aGkxOGUxMTpwaWVjZXMgcm9vdDMyOryYO9v2kD7tZAErfryevFyLb0HWrdRyIk3CnxEgVd56ZWVlMTI6bWV0YSB2ZXJzaW9uaTJlNDpuYW1lNjp2Mi5iaW4xMjpwaWVjZSBsZW5ndGhpMTYzODRlZWU=
hybrid_v1=41ea01236373d80fc64f390a73ef4924ac8d2904
hybrid_v2=d341089faab562d2c722821ec55a92b5a71578a94f2fa4cd5f849e640dc02b42
hybrid_qb_prefix=${hybrid_v2:0:40}
hybrid_torrent=ZDQ6aW5mb2Q5OmZpbGUgdHJlZWQxMDpoeWJyaWQuYmluZDA6ZDY6bGVuZ3RoaTIyZTExOnBpZWNlcyByb290MzI6cQSAen8RmDzTs/9c24a6rb/7z0N8MjVuzXUvDbHywddlZWU2Omxlbmd0aGkyMmUxMjptZXRhIHZlcnNpb25pMmU0Om5hbWUxMDpoeWJyaWQuYmluMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6cGllY2VzMjA6xQCrcqTOQ+LNUqZJC7p47gKZ/GhlZQ==
stall_hash=330be0cb7c2201135a2de63b28e77993745ff688
stall_torrent=ZDQ6aW5mb2Q2Omxlbmd0aGkzMWU0Om5hbWUxMTpmaXh0dXJlLmJpbjEyOnBpZWNlIGxlbmd0aGkxNjM4NGU2OnBpZWNlczIwOlFlB05MtIUU4oem2MNz5LJW/GI6ZWU=
@@ -46,23 +47,37 @@ install_torrent() {
local name=$2
local encoded=$3
compose_node "$node" exec -T qbittorrent /bin/sh -c \
"printf '%s' '$encoded' | base64 -d > /tmp/phase8.torrent"
compose_node "$node" exec -T qbittorrent curl -fsS \
-X POST http://127.0.0.1:8080/api/v2/torrents/add \
-F torrents=@/tmp/phase8.torrent \
-F savepath=/downloads \
-F stopped=true >/dev/null
"printf '%s' '$encoded' | base64 -d > /tmp/phase8.torrent" \
|| return
local attempt
for attempt in 1 2 3; do
if compose_node "$node" exec -T qbittorrent curl -fsS \
-X POST http://127.0.0.1:8080/api/v2/torrents/add \
-F torrents=@/tmp/phase8.torrent \
-F savepath=/downloads \
-F stopped=true >/dev/null; then
break
fi
if (( attempt == 3 )); then
return 1
fi
sleep "$attempt"
done
local qb_hash
qb_hash=$(control_adversarial qb-hash \
--endpoint "$(qb_endpoint "$node")" \
--name "$name")
qb_hash=$(
control_adversarial qb-hash \
--endpoint "$(qb_endpoint "$node")" \
--name "$name"
) || return
compose_node "$node" exec -T qbittorrent curl -fsS \
-X POST http://127.0.0.1:8080/api/v2/torrents/recheck \
--data-urlencode "hashes=$qb_hash" >/dev/null
--data-urlencode "hashes=$qb_hash" >/dev/null \
|| return
control_complex assert-qb \
--endpoint "$(qb_endpoint "$node")" \
--info-hash "$qb_hash" \
--selected '0' >/dev/null
--selected '0' >/dev/null \
|| return
printf '%s' "$qb_hash"
}
@@ -99,7 +114,8 @@ trap restore_test_environment EXIT
for node in cache-1 cache-2 archive-1 archive-2; do
for hash in \
"$v2_hash" "$v2_qb_prefix" "$hybrid_v1" "$hybrid_v2" "$stall_hash"; do
"$v2_hash" "$v2_qb_prefix" "$hybrid_v1" "$hybrid_v2" \
"$hybrid_qb_prefix" "$stall_hash"; do
delete_hash "$node" "$hash"
done
compose_node "$node" exec -T qbittorrent \
@@ -192,6 +208,7 @@ stall_job=$(control_complex drive \
--info-hash "$stall_hash" \
--through source_stage)
compose_node archive-2 stop client
restore_archive2=true
control_adversarial wait-client \
--client-id archive-2 \
--no-connected
@@ -204,6 +221,7 @@ control_adversarial mark-stalled \
--minimum-overall 0.2
compose_node archive-2 start client
control_adversarial wait-client --client-id archive-2
restore_archive2=false
control_complex resume --job-id "$stall_job"
assert_qb_by_name archive-2 fixture.bin