Project

Profile

Help

Issue #6347 ยป test.sh

lmjachky, 04/03/2020 11:36 PM

 
1
#!/usr/bin/env bash
2

    
3
unique_field="relative_path"
4
#unique_field="artifact"
5

    
6
paging_limit=2000
7
#paging_limit=100
8
offset_limit=70000
9

    
10
data_file="tmpf"
11
tmp_file2="tmpf2"
12
tmp_file3="tmpf3"
13

    
14
http ':24817/pulp/api/v3/content/file/files/?limit=2000&offset=0' \
15
    | jq -r '[.results[] | .'"${unique_field}"']' > ${data_file}
16

    
17
for offset in $(seq 2000 ${paging_limit} ${offset_limit})
18
do
19
    echo ". + " > ${tmp_file2}
20
    http ':24817/pulp/api/v3/content/file/files/?limit='"${paging_limit}"'&offset='"${offset}"'' \
21
        | jq -r '[.results[] | .'"${unique_field}"']' >> ${tmp_file2}
22
    jq -f ${tmp_file2} ${data_file} > ${tmp_file3}
23
    cat ${tmp_file3} > ${data_file}
24
    echo "${offset}: $(jq -r 'unique[]' ${data_file} | wc -l)"
25
done
26

    
27
unique_values=$(jq -r 'unique[]' ${data_file} | wc -l)
28
echo "Expected: ${offset_limit}"
29
echo "Actual: ${unique_values}"
    (1-1/1)