test: Update 2 files
This commit is contained in:
10
sos
10
sos
@@ -28,7 +28,17 @@ function get_getpkg() {
|
|||||||
fi
|
fi
|
||||||
if [ ! -f "${GETPKG}" ]; then
|
if [ ! -f "${GETPKG}" ]; then
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
# Normalize architecture names (aarch64 -> arm64 for some systems)
|
||||||
|
if [ "$ARCH" = "aarch64" ]; then
|
||||||
|
# Try aarch64 first, fall back to arm64 if it fails
|
||||||
|
curl -L -s -o "${TEMP_DIR}/getpkg" "https://getbin.xyz/getpkg:latest-${ARCH}" 2>/dev/null
|
||||||
|
if [ ! -f "${TEMP_DIR}/getpkg" ] || [ ! -s "${TEMP_DIR}/getpkg" ]; then
|
||||||
|
ARCH="arm64"
|
||||||
|
curl -L -s -o "${TEMP_DIR}/getpkg" "https://getbin.xyz/getpkg:latest-${ARCH}" || die "Failed to download getpkg for ARM64"
|
||||||
|
fi
|
||||||
|
else
|
||||||
curl -L -s -o "${TEMP_DIR}/getpkg" "https://getbin.xyz/getpkg:latest-${ARCH}" || die "Failed to download getpkg"
|
curl -L -s -o "${TEMP_DIR}/getpkg" "https://getbin.xyz/getpkg:latest-${ARCH}" || die "Failed to download getpkg"
|
||||||
|
fi
|
||||||
chmod +x "${TEMP_DIR}/getpkg"
|
chmod +x "${TEMP_DIR}/getpkg"
|
||||||
GETPKG="${TEMP_DIR}/getpkg"
|
GETPKG="${TEMP_DIR}/getpkg"
|
||||||
[ -f "${GETPKG}" ] || die "Failed to download getpkg"
|
[ -f "${GETPKG}" ] || die "Failed to download getpkg"
|
||||||
|
12
test.sh
12
test.sh
@@ -93,7 +93,8 @@ start_test_server() {
|
|||||||
docker exec "${CONTAINER_NAME}" mkdir -p /data/storage 2>/dev/null || true
|
docker exec "${CONTAINER_NAME}" mkdir -p /data/storage 2>/dev/null || true
|
||||||
docker restart "${CONTAINER_NAME}" &>/dev/null || die "Failed to restart container"
|
docker restart "${CONTAINER_NAME}" &>/dev/null || die "Failed to restart container"
|
||||||
|
|
||||||
sleep 3 # Wait for restart
|
# ARM64 systems may need more time to restart
|
||||||
|
sleep 5 # Wait for restart
|
||||||
|
|
||||||
# Update port if changed after restart
|
# Update port if changed after restart
|
||||||
local new_port=$(docker port "${CONTAINER_NAME}" 80 | cut -d: -f2)
|
local new_port=$(docker port "${CONTAINER_NAME}" 80 | cut -d: -f2)
|
||||||
@@ -165,11 +166,16 @@ test_upload() {
|
|||||||
|
|
||||||
log_info "Testing upload: ${file##*/} with label ${label}"
|
log_info "Testing upload: ${file##*/} with label ${label}"
|
||||||
|
|
||||||
if run_sos_upload "$file" "$label" "$@" 2>&1 | tee "${TEST_DIR}/upload_output.txt" | grep -q "Download URL:"; then
|
local output=$(run_sos_upload "$file" "$label" "$@" 2>&1 | tee "${TEST_DIR}/upload_output.txt")
|
||||||
|
|
||||||
|
if echo "$output" | grep -q "Download URL:"; then
|
||||||
log_info "Upload successful"
|
log_info "Upload successful"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
log_error "Upload failed"
|
log_error "Upload failed"
|
||||||
|
# Show error details for debugging ARM64 issues
|
||||||
|
echo "Error output:" >&2
|
||||||
|
echo "$output" | grep -E "(FATAL:|ERROR:|Failed|curl)" | head -5 >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -297,6 +303,8 @@ run_tests() {
|
|||||||
for test in "${tests[@]}"; do
|
for test in "${tests[@]}"; do
|
||||||
eval "$test" && ((passed++)) || true
|
eval "$test" && ((passed++)) || true
|
||||||
echo ""
|
echo ""
|
||||||
|
# Small delay between tests for ARM64 stability
|
||||||
|
sleep 0.5
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user