Actions
Test #5145
closedTest scenario for deleting an uploaded content
Version:
Platform Release:
Tags:
Sprint:
Quarter:
Description
With the pull request https://github.com/pulp/pulpcore/pull/210 comes a change which fixes the issue that prevented users to delete uploaded content from a file system via REST API.
A following test scenario may be used:
1. Create a random file:
dd if=/dev/zero of=2g.bin bs=256M count=8
2. Upload it, e.g. chunk by chunk (source: https://pulp.plan.io/attachments/518614):
#!/bin/bash
pkg=$1
PORT=http://localhost:24817
size=$(ls -l $pkg | cut -d ' ' -f5)
echo "get sha256 sum"
sha256=$(sha256sum $pkg | cut -d ' ' -f1)
echo sha256=$sha256
echo "Split file"
split --bytes=300M $pkg chunk
export UPLOAD=$(http POST $PORT/pulp/api/v3/uploads/ size=$size | jq -r '._href')
echo $UPLOAD
n=0
# get chunck files infos
for f in chunk*; do
fname[$n]=$f
fsize[$n]=$(ls -l $f | cut -d ' ' -f5)
if [ $n -eq 0 ]; then
bindex[$n]=0
else
bindex[$n]=$((${eindex[$(($n-1))]} + 1))
fi
eindex[$n]=$((fsize[$n] + ${bindex[$n]} - 1))
n=$(($n+1))
done
# upload chuncks
for n in ${!fname[*]}; do
echo "Uploading: ${fname[$n]} ${bindex[$n]}-${eindex[$n]}"
http --form PUT $PORT$UPLOAD file@${fname[$n]} "Content-Range:bytes ${bindex[$n]}-${eindex[$n]}/*"
done
echo "Ending Upload"
http PUT $PORT${UPLOAD}commit/ sha256=$sha256
3. Delete uploaded content via REST API:
#!/bin/bash
PORT=http://localhost:24817
for u in $(http $PORT/pulp/api/v3/uploads/ | jq -r '.results[] | ._href'); do
echo $u
http DELETE $PORT$u
done
4. Check if the upload was deleted:
{
"count": 0,
"next": null,
"previous": null,
"results": []
}
cd /var/lib/pulp/uploads/
Related issues
Actions
Add test for testing the delete method of uploads
closes #5145 https://pulp.plan.io/issues/5145