Skip to content

Commit

Permalink
fixup! [wip][feature] Add support for fsspec backends
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlnkn committed Oct 5, 2024
1 parent 7cb5e05 commit 0182743
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions tests/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1797,26 +1797,48 @@ 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.
# TODO Debug this... Bug could be in fsspec/implementations/http.py, aiohttp, RangeHTTPServer, ...
# 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 &
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"
}


Expand Down Expand Up @@ -1887,7 +1909,7 @@ EOF
mountPoint=$( mktemp -d )

archive="ssh://127.0.0.1:$port/tests/single-file.tar"
runAndCheckRatarmount -c -f "$archive" "$mountPoint" &
runAndCheckRatarmount -d 3 -c -f "$archive" "$mountPoint" &
while ! mountpoint -q -- "$mountPoint"; do sleep 1s; done
echo "Check access to $archive"
verifyCheckSum "$mountPoint" "bar" "$archive" d3b07384d113edec49eaa6238ad5ff00 ||
Expand All @@ -1912,6 +1934,7 @@ EOF

kill $pid
killRogueSSH
rmdir "$mountPoint"
}


Expand Down Expand Up @@ -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

Expand All @@ -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'

Expand Down

0 comments on commit 0182743

Please sign in to comment.