-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! [wip] Add tests and documentation for IPFS, TODO: SMB, DropBox…
…, Hf
- Loading branch information
Showing
4 changed files
with
140 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ pyminizip | |
pyopenssl>=23 | ||
rangehttpserver | ||
boto3 | ||
wsgidav | ||
cheroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2115,7 +2115,7 @@ checkURLProtocolS3() | |
|
||
weedFolder=$( mktemp -d --suffix .test.ratarmount ) | ||
TMP_FILES_TO_CLEANUP+=( "$weedFolder" ) | ||
./weed server -dir="$weedFolder" -s3 -s3.port "$port" -idleTimeout=30 -ip 127.0.0.1 2>weed.log & | ||
./weed server -dir="$weedFolder" -s3 -s3.port "$port" -idleTimeout=30 -ip 127.0.0.1 & | ||
pid=$! | ||
|
||
# Wait for port to open | ||
|
@@ -2209,6 +2209,13 @@ checkURLProtocolSamba() | |
|
||
checkURLProtocolIPFS() | ||
{ | ||
# TODO ipfsspec still fails to import with Python 3.14 | ||
# https://github.com/eigenein/protobuf/issues/177 | ||
python3MinorVersion=$( python3 -c 'import sys; print(sys.version_info.minor)' ) | ||
if [[ -n "$python3MinorVersion" && "$python3MinorVersion" -ge 14 ]]; then | ||
return 0 | ||
fi | ||
|
||
# Using impacket/examples/smbserver.py does not work for a multidude of reasons. | ||
# Therefore set up a server with tests/install-smbd.sh from outside and check for its existence here. | ||
local ipfs | ||
|
@@ -2222,9 +2229,11 @@ checkURLProtocolIPFS() | |
ipfs=kubo/ipfs | ||
fi | ||
|
||
local pid= | ||
$ipfs init --profile server | ||
if ! pgrep ipfs; then | ||
$ipfs daemon & | ||
pid=$! | ||
sleep 5 | ||
fi | ||
|
||
|
@@ -2240,6 +2249,75 @@ checkURLProtocolIPFS() | |
d3b07384d113edec49eaa6238ad5ff00 || returnError "$LINENO" 'Failed to read from IPFS' | ||
checkFileInTARForeground "ipfs://QmZwm9gKZaayGWqYtMgj6cd4JaNK1Yp2ChYZhXrERGq4Gi" single-file.tar \ | ||
1a28538854d1884e4415cb9bfb7a2ad8 || returnError "$LINENO" 'Failed to read from IPFS' | ||
|
||
if [[ -n "$pid" ]]; then kill "$pid"; fi | ||
} | ||
|
||
|
||
checkURLProtocolWebDAV() | ||
{ | ||
if ! pip show wsgidav &>/dev/null; then | ||
echoerr "Skipping WebDAV test because wsigdav package is not installed." | ||
return 0 | ||
fi | ||
|
||
local port=8047 | ||
# BEWARE OF LOOP MOUNTS when testing locally! | ||
# It will time out, when trying to expose PWD via WebDAV while mounting into PWD/mounted. | ||
wsgidav --host=127.0.0.1 --port=8047 --root="$PWD" --auth=anonymous & | ||
local pid=$! | ||
sleep 5 | ||
|
||
checkFileInTARForeground "webdav://127.0.0.1:$port/single-file.tar" bar \ | ||
d3b07384d113edec49eaa6238ad5ff00 || returnError "$LINENO" 'Failed to read from WebDAV server' | ||
checkFileInTARForeground "webdav://127.0.0.1:$port" single-file.tar \ | ||
1a28538854d1884e4415cb9bfb7a2ad8 || returnError "$LINENO" 'Failed to read from WebDAV server' | ||
|
||
kill "$pid" | ||
|
||
local user password | ||
user='pqvfumqbqp' | ||
password='ioweb123GUIweb' | ||
|
||
cat <<EOF > wsgidav-config.yaml | ||
http_authenticator: | ||
domain_controller: null # Same as wsgidav.dc.simple_dc.SimpleDomainController | ||
accept_basic: true # Pass false to prevent sending clear text passwords | ||
accept_digest: true | ||
default_to_digest: true | ||
simple_dc: | ||
user_mapping: | ||
"*": | ||
"$user": | ||
password: "$password" | ||
EOF | ||
|
||
wsgidav --host=127.0.0.1 --port=8047 --root="$PWD" --config=wsgidav-config.yaml & | ||
pid=$! | ||
sleep 5 | ||
|
||
checkFileInTARForeground "webdav://$user:$password@127.0.0.1:$port/single-file.tar" bar \ | ||
d3b07384d113edec49eaa6238ad5ff00 || returnError "$LINENO" 'Failed to read from WebDAV server' | ||
checkFileInTARForeground "webdav://$user:$password@127.0.0.1:$port" single-file.tar \ | ||
1a28538854d1884e4415cb9bfb7a2ad8 || returnError "$LINENO" 'Failed to read from WebDAV server' | ||
|
||
export WEBDAV_USER=$user | ||
export WEBDAV_PASSWORD=$password | ||
checkFileInTARForeground "webdav://127.0.0.1:$port/single-file.tar" bar \ | ||
d3b07384d113edec49eaa6238ad5ff00 || returnError "$LINENO" 'Failed to read from WebDAV server' | ||
checkFileInTARForeground "webdav://127.0.0.1:$port" single-file.tar \ | ||
1a28538854d1884e4415cb9bfb7a2ad8 || returnError "$LINENO" 'Failed to read from WebDAV server' | ||
unset WEBDAV_USER | ||
unset WEBDAV_PASSWORD | ||
|
||
# This server using SSL also works, but do not overload it with regular tests. | ||
# ratarmount 'webdav://www.dlp-test.com\WebDAV:[email protected]/webdav' mounted | ||
# checkFileInTARForeground "webdav://www.dlp-test.com\WebDAV:[email protected]/webdav" \ | ||
# mounted/WebDAV_README.txt 87d13914fe24e486be943cb6b1f4e224 || | ||
# returnError "$LINENO" 'Failed to read from WebDAV server' | ||
|
||
kill "$pid" | ||
} | ||
|
||
|
||
|
@@ -2259,8 +2337,7 @@ checkRemoteSupport() | |
checkURLProtocolSSH || returnError 'Failed ssh:// check' | ||
|
||
checkURLProtocolSamba || returnError 'Failed smb:// check' | ||
# TODO Add and test IPFS | ||
# TODO look for other fsspec implementations in an automated manner | ||
checkURLProtocolWebDAV || returnError 'Failed webdav:// check' | ||
} | ||
|
||
|
||
|