fix(test): correct due to commit 43cf4a2bg

- MKCOL is now better protected
    - Webdav now handle 201 (created) 204 (overritten)
This commit is contained in:
Edouard Vanbelle
2026-06-30 20:18:10 +02:00
parent 5631b7e062
commit 1e2882973b
4 changed files with 56 additions and 32 deletions
+10 -4
View File
@@ -116,18 +116,24 @@ for REMOTE in "$FILE_A" "$FILE_B"; do
done
# ── Step 1: Upload file A ─────────────────────────────────────────────────────
# Post commit 43cf4a2b, PUT distinguishes create (201) from overwrite (204)
# per RFC 7231 §4.3.4. Both files are NEW here (the purge_from_trash loop
# above wiped any leftover state), so we expect 201 on each PUT.
echo " step 1: PUT $FILE_A..."
STATUS=$(webdav_put "$FILE_A" "$FIXTURE" "video/mp4")
[[ "$STATUS" == "204" ]] || fail "PUT $FILE_A expected 204, got $STATUS"
pass "PUT $FILE_A → 204 (new manifest, 8 chunk blobs created)"
[[ "$STATUS" == "201" ]] || fail "PUT $FILE_A expected 201, got $STATUS"
pass "PUT $FILE_A → 201 (new manifest, 8 chunk blobs created)"
# ── Step 2: Upload file B (same content, different name → dedup hit) ──────────
# File B is a distinct resource (new path), so PUT still emits 201 even though
# the underlying blob is dedup'd. 201 vs 204 reflects "is this a new HTTP
# resource at this URL", not "is the byte content novel".
echo " step 2: PUT $FILE_B (same bytes → dedup hit)..."
STATUS=$(webdav_put "$FILE_B" "$FIXTURE" "video/mp4")
[[ "$STATUS" == "204" ]] || fail "PUT $FILE_B expected 204, got $STATUS"
pass "PUT $FILE_B → 204 (dedup hit: manifest ref_count → 2, chunks unchanged)"
[[ "$STATUS" == "201" ]] || fail "PUT $FILE_B expected 201, got $STATUS"
pass "PUT $FILE_B → 201 (dedup hit: manifest ref_count → 2, chunks unchanged)"
# ── Resolve file IDs ──────────────────────────────────────────────────────────
+9 -4
View File
@@ -122,18 +122,23 @@ for REMOTE in "$FILE_A" "$FILE_B"; do
done
# ── Step 1: Upload file A ─────────────────────────────────────────────────────
# Post commit 43cf4a2b, PUT distinguishes create (201) from overwrite (204)
# per RFC 7231 §4.3.4. The wipe loop above ensures A and B are NEW resources
# here, so we expect 201. Step 5 below tests the overwrite case (expects 204).
echo " step 1: PUT $FILE_A (dedup-test.jpg)..."
STATUS=$(webdav_put "$FILE_A" "$FIXTURE_A" "image/jpeg")
[[ "$STATUS" == "204" ]] || fail "PUT $FILE_A expected 204, got $STATUS"
pass "PUT $FILE_A → 204"
[[ "$STATUS" == "201" ]] || fail "PUT $FILE_A expected 201, got $STATUS"
pass "PUT $FILE_A → 201"
# ── Step 2: Upload file B (identical content, different name) ─────────────────
# Distinct resource (new path), so PUT emits 201 even though the underlying
# blob dedup-hits. 201 vs 204 reflects URL freshness, not byte freshness.
echo " step 2: PUT $FILE_B (dedup-test-2.jpg, same bytes)..."
STATUS=$(webdav_put "$FILE_B" "$FIXTURE_B" "image/jpeg")
[[ "$STATUS" == "204" ]] || fail "PUT $FILE_B expected 204, got $STATUS"
pass "PUT $FILE_B → 204"
[[ "$STATUS" == "201" ]] || fail "PUT $FILE_B expected 201, got $STATUS"
pass "PUT $FILE_B → 201"
# ── Step 3: Resolve file IDs and assert two distinct records ──────────────────
+11 -12
View File
@@ -140,22 +140,21 @@ pass "M2: 5 responses, trailing-slash semantics correct on native /webdav/ surfa
# the lifecycle (which the existing test_dedup_webdav_* scripts
# also exercise at root) actually validates.
echo " M3: PUT /webdav/m3-sample.txt (pinned: native always 204, NC would be 201 on new)"
echo " M3: PUT /webdav/m3-sample.txt → 201 (new resource, post 43cf4a2b)"
# Post commit 43cf4a2b, the native WebDAV handler differentiates
# new-vs-overwrite per RFC 7231 §4.3.4: 201 Created for a fresh PUT,
# 204 No Content when replacing an existing resource. Aligns with the
# NC handler — there's no more native-vs-NC split on this point.
# (Prior to 43cf4a2b the native handler returned 204 for both; the M3
# `case` block was a forward-looking trip-wire telling the next reader
# to update this pin once the split happened. That moment is now.)
STATUS=$(dav_curl -o /dev/null -w "%{http_code}" -X PUT \
-H "Content-Type: text/plain" \
--data-binary 'sample contents — exactly 31 bytes' \
"$DAV_BASE/m3-sample.txt")
case "$STATUS" in
204)
pass "M3: native PUT new → 204 (pinned current behaviour; differs from NC's 201/204 split)"
;;
201)
fail "M3: native PUT now returns 201 for new — handler differentiates new-vs-overwrite. Update pin if intentional."
;;
*)
fail "M3: unexpected status $STATUS"
;;
esac
[[ "$STATUS" == "201" ]] \
|| fail "M3: native PUT new expected 201, got $STATUS"
pass "M3: native PUT new → 201"
# ─────────────────────────────────────────────────────────────
# M4 — Range GET bytes=0-9 → 206 + 10 bytes