From 72ec75d50f416c4d091d7f88af8800d1cada6660 Mon Sep 17 00:00:00 2001 From: mxmlnkn Date: Sat, 5 Oct 2024 23:27:28 +0200 Subject: [PATCH] fixup! [wip][feature] Add support for fsspec backends --- tests/runtests.sh | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/tests/runtests.sh b/tests/runtests.sh index 78a5c84e..95301ab9 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -1797,7 +1797,11 @@ checkURLProtocolFile() checkURLProtocolHTTP() { - local pid + local pid mountPoint protocol port + mountPoint=$( mktemp -d ) + protocol='http' + port=8008 + # Failed alternatives to set up a test HTTP server: # python3 -m http.server -b 127.0.0.1 8000 & # Does not support range requests # python3 -m RangeHTTPServer -b 127.0.0.1 8000 & # Client has spurious errors every 5th test or so with this. @@ -1805,18 +1809,36 @@ checkURLProtocolHTTP() # sudo apt install busybox-static # busybox httpd -f -p 8000 & # Does not support range requests. # sudo apt install ruby-webrick - ruby -run -e httpd . --port 8000 --bind-address=127.0.0.1 &>/dev/null & + ruby -run -e httpd . --port $port --bind-address=127.0.0.1 &>/dev/null & pid=$! sleep 1 - checkFileInTAR 'http://127.0.0.1:8000/tests/single-file.tar' bar d3b07384d113edec49eaa6238ad5ff00 || - returnError "$LINENO" 'Failed to read from HTTP server' - checkFileInTAR 'http://127.0.0.1:8000/tests/' single-file.tar 1a28538854d1884e4415cb9bfb7a2ad8 || - returnError "$LINENO" 'Failed to read from HTTP server folder' - checkFileInTAR 'http://127.0.0.1:8000/tests' single-file.tar 1a28538854d1884e4415cb9bfb7a2ad8 || - returnError "$LINENO" 'Failed to read from HTTP server folder' + archive="$protocol://127.0.0.1:$port/tests/single-file.tar" + runAndCheckRatarmount -c -f "$archive" "$mountPoint" & + while ! mountpoint -q -- "$mountPoint"; do sleep 1s; done + echo "Check access to $archive" + verifyCheckSum "$mountPoint" "bar" "$archive" d3b07384d113edec49eaa6238ad5ff00 || + returnError "$LINENO" 'Checksum mismatches!' + funmount "$mountPoint" - kill $pid + archive="$protocol://127.0.0.1:$port/tests/" + runAndCheckRatarmount -c -f "$archive" "$mountPoint" & + while ! mountpoint -q -- "$mountPoint"; do sleep 1s; done + echo "Check access to $archive" + verifyCheckSum "$mountPoint" 'single-file.tar' "$archive" 1a28538854d1884e4415cb9bfb7a2ad8 || + returnError "$LINENO" 'Checksum mismatches!' + funmount "$mountPoint" + + archive="$protocol://127.0.0.1:$port/tests" + runAndCheckRatarmount -c -f "$archive" "$mountPoint" & + while ! mountpoint -q -- "$mountPoint"; do sleep 1s; done + echo "Check access to $archive" + verifyCheckSum "$mountPoint" 'single-file.tar' "$archive" 1a28538854d1884e4415cb9bfb7a2ad8 || + returnError "$LINENO" 'Checksum mismatches!' + funmount "$mountPoint" + + kill $pid &>/dev/null + rmdir "$mountPoint" } @@ -1912,6 +1934,7 @@ EOF kill $pid killRogueSSH + rmdir "$mountPoint" } @@ -2100,6 +2123,8 @@ EOF checkRemoteSupport() { + checkURLProtocolHTTP + exit 1 # Some implementations of fsspec. See e.g. this list: # https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations @@ -2108,7 +2133,7 @@ checkRemoteSupport() checkURLProtocolGithub || returnError 'Failed github:// check' checkURLProtocolFTP || returnError 'Failed ftp:// check' - #checkURLProtocolHTTP # TODO + checkURLProtocolHTTP || returnError 'Failed http:// check' #checkURLProtocolS3 # TODO suddenly broken again ... checkURLProtocolSSH || returnError 'Failed ssh:// check'