zotregistry.dev/zot@v1.4.4-0.20240314164342-eec277e14d20/test/blackbox/helpers_scrub.bash (about)

     1  function add_test_files() {
     2      local zot_root_dir=${BATS_FILE_TMPDIR}/zot
     3      echo ${zot_root_dir}
     4      cp -r ${TEST_DATA_DIR}/alpine ${zot_root_dir}
     5      ls -al ${zot_root_dir}/alpine
     6  }
     7  
     8  function delete_blob() {
     9      local zot_test_files=${BATS_FILE_TMPDIR}/zot/alpine
    10      # Delete one of the blobs which is not of type json, meaning not a manifest/config
    11      find ${zot_test_files}/blobs/sha256 -maxdepth 1 -type f -name "*" -exec sh -c 'file -b "$1" | grep -iqv "json"' sh {} \; -print0|
    12          sort -z -R |
    13          head -z -n 1 | xargs -0 rm
    14      ls -al ${zot_test_files}/blobs/sha256/
    15  }
    16  
    17  function log_output() {
    18      local zot_log_file=${BATS_FILE_TMPDIR}/zot/zot-log.json
    19      cat ${zot_log_file} | jq ' .["message"] '
    20  }
    21  
    22  function affected() {
    23      log_output | jq 'contains("blobs/manifest affected")?' | grep true
    24  }
    25  
    26  function not_affected() {
    27      log_output | jq 'contains("blobs/manifest ok")?' | grep true
    28  }