'Generic Commit'
All checks were successful
Build-Test-Publish / build (linux/arm64) (push) Successful in 46s
Build-Test-Publish / build (linux/amd64) (push) Successful in 48s

This commit is contained in:
Your Name 2025-06-22 11:40:19 +12:00
parent 9cc2f2b9c4
commit 72bceebde8

View File

@ -45,13 +45,18 @@ cleanup() {
# Remove local test directories # Remove local test directories
rm -rf "$TEST_DIR" rm -rf "$TEST_DIR"
rm -rf ~/.config/getpkg/"${TEST_TOOL_NAME}.json" 2>/dev/null || true rm -rf ~/.config/getpkg/"${TEST_TOOL_NAME}.json" 2>/dev/null || true
rm -rf ~/.config/getpkg/"${TEST_TOOL_NAME}-noarch.json" 2>/dev/null || true
rm -rf ~/.getpkg/"${TEST_TOOL_NAME}" 2>/dev/null || true
rm -rf ~/.getpkg/"${TEST_TOOL_NAME}-noarch" 2>/dev/null || true
rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" 2>/dev/null || true rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" 2>/dev/null || true
rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}-noarch" 2>/dev/null || true
# Remove test tool from bashrc_getpkg if it exists # Remove test tool from bashrc_getpkg if it exists
# if [ -f ~/.bashrc_getpkg ]; then # if [ -f ~/.bashrc_getpkg ]; then
# sed -i "/${TEST_TOOL_NAME}/d" ~/.bashrc_getpkg 2>/dev/null || true # sed -i "/${TEST_TOOL_NAME}/d" ~/.bashrc_getpkg 2>/dev/null || true
# fi # fi
$GETPKG uninstall "$TEST_TOOL_NAME" 2>/dev/null || true $GETPKG uninstall "$TEST_TOOL_NAME" 2>/dev/null || true
$GETPKG uninstall "${TEST_TOOL_NAME}-noarch" 2>/dev/null || true
# Clean up from getpkg.xyz if we have write access # Clean up from getpkg.xyz if we have write access
if [ -n "${SOS_WRITE_TOKEN:-}" ]; then if [ -n "${SOS_WRITE_TOKEN:-}" ]; then
@ -294,7 +299,7 @@ if [ -n "${SOS_WRITE_TOKEN:-}" ]; then
# Test 10: Check installed files # Test 10: Check installed files
echo -e "\nTest 10: Check installed files" echo -e "\nTest 10: Check installed files"
if [ -f ~/.config/getpkg/"${TEST_TOOL_NAME}.json" ] && [ -d ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" ]; then if [ -f ~/.config/getpkg/"${TEST_TOOL_NAME}.json" ] && [ -d ~/.getpkg/"${TEST_TOOL_NAME}" ] && [ -L ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" ]; then
print_test_result "Tool files installed correctly" 0 print_test_result "Tool files installed correctly" 0
else else
print_test_result "Tool files installed correctly" 1 print_test_result "Tool files installed correctly" 1
@ -311,7 +316,8 @@ if [ -n "${SOS_WRITE_TOKEN:-}" ]; then
# Test 12: Direct tool name install (shortcut syntax) # Test 12: Direct tool name install (shortcut syntax)
echo -e "\nTest 12: Direct tool install syntax" echo -e "\nTest 12: Direct tool install syntax"
# First remove the tool # First remove the tool
rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" rm -rf ~/.getpkg/"${TEST_TOOL_NAME}"
rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}"
rm -f ~/.config/getpkg/"${TEST_TOOL_NAME}.json" rm -f ~/.config/getpkg/"${TEST_TOOL_NAME}.json"
DIRECT_INSTALL_OUTPUT=$(timeout 3 "$GETPKG" "$TEST_TOOL_NAME" 2>&1) || DIRECT_INSTALL_OUTPUT="" DIRECT_INSTALL_OUTPUT=$(timeout 3 "$GETPKG" "$TEST_TOOL_NAME" 2>&1) || DIRECT_INSTALL_OUTPUT=""
@ -382,7 +388,7 @@ EOF
# Test 13c: Install universal tool (arch fallback) # Test 13c: Install universal tool (arch fallback)
echo -e "\nTest 13c: Install universal tool (arch fallback)" echo -e "\nTest 13c: Install universal tool (arch fallback)"
rm -rf ~/.config/getpkg/"${TEST_TOOL_NOARCH}.json" ~/.local/bin/getpkg/"${TEST_TOOL_NOARCH}" 2>/dev/null || true rm -rf ~/.config/getpkg/"${TEST_TOOL_NOARCH}.json" ~/.getpkg/"${TEST_TOOL_NOARCH}" ~/.local/bin/getpkg/"${TEST_TOOL_NOARCH}" 2>/dev/null || true
FALLBACK_INSTALL_OUTPUT=$(timeout 3 "$GETPKG" install "${TEST_TOOL_NOARCH}" 2>&1) || FALLBACK_INSTALL_OUTPUT="" FALLBACK_INSTALL_OUTPUT=$(timeout 3 "$GETPKG" install "${TEST_TOOL_NOARCH}" 2>&1) || FALLBACK_INSTALL_OUTPUT=""
if [[ "$FALLBACK_INSTALL_OUTPUT" =~ Arch-specific\ version\ not\ found,\ trying\ universal\ version ]] && [[ "$FALLBACK_INSTALL_OUTPUT" =~ Installed\ ${TEST_TOOL_NOARCH}\ successfully ]]; then if [[ "$FALLBACK_INSTALL_OUTPUT" =~ Arch-specific\ version\ not\ found,\ trying\ universal\ version ]] && [[ "$FALLBACK_INSTALL_OUTPUT" =~ Installed\ ${TEST_TOOL_NOARCH}\ successfully ]]; then
print_test_result "Install universal tool with arch fallback" 0 print_test_result "Install universal tool with arch fallback" 0