Project

Profile

Help

Test #5145

Test scenario for deleting an uploaded content

Added by lmjachky 3 months ago. Updated 8 days ago.

Status:
CLOSED - COMPLETE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Version:
Platform Release:
Tags:
Sprint:

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:

http http://localhost:24817/pulp/api/v3/uploads/

{
    "count": 0,
    "next": null,
    "previous": null,
    "results": []
}

cd /var/lib/pulp/uploads/


Related issues

Related to Pulp - Issue #5092: Files are not deleted whent deleting uploads MODIFIED Actions

Associated revisions

Revision 21bb248a View on GitHub
Added by Lubos Mjachky 3 months ago

Add test for testing the delete method of uploads

closes #5145
https://pulp.plan.io/issues/5145

History

#1 Updated by lmjachky 3 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to lmjachky

#2 Updated by lmjachky 3 months ago

  • Status changed from ASSIGNED to POST

#3 Updated by Anonymous 3 months ago

  • Status changed from POST to MODIFIED

#4 Updated by kersom 2 months ago

  • Related to Issue #5092: Files are not deleted whent deleting uploads added

#5 Updated by kersom 8 days ago

  • Status changed from MODIFIED to CLOSED - COMPLETE

Please register to edit this issue

Also available in: Atom PDF