diff --git a/test_blossom/Example.png b/test_blossom/Example.png new file mode 100644 index 0000000..aa61359 Binary files /dev/null and b/test_blossom/Example.png differ diff --git a/test_blossom/avatar-placeholder.webp b/test_blossom/avatar-placeholder.webp deleted file mode 100644 index e8f5973..0000000 Binary files a/test_blossom/avatar-placeholder.webp and /dev/null differ diff --git a/test_blossom/config.toml b/test_blossom/config.toml index c6b2f8f..fb49bb3 100644 --- a/test_blossom/config.toml +++ b/test_blossom/config.toml @@ -25,9 +25,9 @@ allow_scrape_if_max_seconds = 7200 max_subscriptions = 128 serve_ephemeral = true serve_relay_lists = true -server_log_level = "Info" -library_log_level = "Info" -client_log_level = "Warn" +server_log_level = "Debug" +library_log_level = "Debug" +client_log_level = "Debug" enable_ip_blocking = true minimum_ban_seconds = 1 timeout_seconds = 60 diff --git a/test_blossom/test.sh b/test_blossom/test.sh index 7ef675b..587b703 100755 --- a/test_blossom/test.sh +++ b/test_blossom/test.sh @@ -20,20 +20,23 @@ fi # UPLOAD TEST ------------ -FILE="./avatar-placeholder.webp" +FILE="./Example.png" HASH=$(sha256sum $FILE | awk '{print $1}') # Generate nostr auth AUTH=$(./create_auth.sh upload $HASH) -# Upload -DESCRIPTOR=$(curl -s --data-binary @"$FILE" -X PUT --header "$AUTH" http://127.0.0.1:8089/upload) +# Upload (note we clobber the content type) +DESCRIPTOR=$(curl -vfs --data-binary @"$FILE" -H "Content-Type: " -X PUT --header "$AUTH" http://127.0.0.1:8089/upload) if [ $? -ne 0 ] ; then echo "FAILED: Curl (uploading) exited with a non-zero status" exit 1 fi echo "PASS: FILE UPLOADED" +## FIXME check for 4xx and 5xx error codes + + # Extract the sha256 and compare it DHASH=$(echo "$DESCRIPTOR" | jq -r .sha256) if [ $? -ne 0 ] ; then @@ -42,6 +45,7 @@ if [ $? -ne 0 ] ; then fi if [ "$HASH" != "$DHASH" ] ; then echo "returned descriptor 'sha256' does not match the hash" + exit 1 fi echo "PASS: DESCRIPTOR HASH MATCHES" @@ -52,6 +56,8 @@ if [ $? -ne 0 ] ; then exit 1 fi +echo "Descriptor URL = $URL" + # DOWNLOAD TEST ----------- curl -s "$URL" > downloaded