Skip to content

Commit

Permalink
Test: Check storage_buckets file integrity is preserved (#14120)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Sep 18, 2024
2 parents 180942e + 901dc97 commit 1c2e3c6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/suites/storage_buckets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ EOF
# Test putting a file into a bucket.
lxdTestFile="bucketfile_${bucketPrefix}.txt"
head -c 5M /dev/urandom > "${lxdTestFile}"
ORIG_MD5SUM="$(md5sum < "${lxdTestFile}")"
s3cmdrun "${lxd_backend}" "${adAccessKey}" "${adSecretKey}" put "${lxdTestFile}" "s3://${bucketPrefix}.foo"
! s3cmdrun "${lxd_backend}" "${roAccessKey}" "${roSecretKey}" put "${lxdTestFile}" "s3://${bucketPrefix}.foo" || false

Expand All @@ -119,9 +120,15 @@ EOF
s3cmdrun "${lxd_backend}" "${roAccessKey}" "${roSecretKey}" ls "s3://${bucketPrefix}.foo" | grep -F "${lxdTestFile}"

# Test getting a file from a bucket.
INFO_MD5SUM="$(s3cmdrun "${lxd_backend}" "${adAccessKey}" "${adSecretKey}" info "s3://${bucketPrefix}.foo/${lxdTestFile}" | awk '{ if ($1 == "MD5") {print $3}}') -"
s3cmdrun "${lxd_backend}" "${adAccessKey}" "${adSecretKey}" get "s3://${bucketPrefix}.foo/${lxdTestFile}" "${lxdTestFile}.get"
[ "${ORIG_MD5SUM}" = "${INFO_MD5SUM}" ]
[ "${ORIG_MD5SUM}" = "$(md5sum < "${lxdTestFile}.get")" ]
rm "${lxdTestFile}.get"
INFO_MD5SUM="$(s3cmdrun "${lxd_backend}" "${roAccessKey}" "${roSecretKey}" info "s3://${bucketPrefix}.foo/${lxdTestFile}" | awk '{ if ($1 == "MD5") {print $3}}') -"
s3cmdrun "${lxd_backend}" "${roAccessKey}" "${roSecretKey}" get "s3://${bucketPrefix}.foo/${lxdTestFile}" "${lxdTestFile}.get"
[ "${ORIG_MD5SUM}" = "${INFO_MD5SUM}" ]
[ "${ORIG_MD5SUM}" = "$(md5sum < "${lxdTestFile}.get")" ]
rm "${lxdTestFile}.get"

# Test setting bucket policy to allow anonymous access (also tests bucket URL generation).
Expand Down

0 comments on commit 1c2e3c6

Please sign in to comment.