fix: resolve sf-logs-tail utils.sh dependency by reorganizing directory structure

- Renamed misc/ directory to utils/ for better organization
- Updated sf-logs-tail to source utils/utils.sh correctly
- This fixes the 'No such file or directory' error when running sf-logs-tail
- The utils directory contains cross-platform timeout functions needed for macOS compatibility
This commit is contained in:
reynold
2025-08-28 22:57:07 +08:00
parent b99cdc1959
commit 4020d881f1
12 changed files with 4 additions and 4 deletions

122
utils/quick-test.sh Executable file
View File

@@ -0,0 +1,122 @@
#!/bin/bash
set -euo pipefail
# Quick Validation Test for SF CLI Wrapper Scripts
# Tests essential functionality with PWC-TEAM-DEV org
readonly TEST_ORG="PWC-TEAM-DEV"
readonly GREEN='\033[0;32m'
readonly RED='\033[0;31m'
readonly YELLOW='\033[0;33m'
readonly BLUE='\033[0;34m'
readonly NC='\033[0m' # No Color
echo -e "${BLUE}SF CLI Wrapper Quick Validation${NC}"
echo -e "${BLUE}===============================${NC}"
echo -e "${YELLOW}Target Org: $TEST_ORG${NC}"
echo ""
# Test counters
TESTS=0
PASSED=0
test_help() {
local script="$1"
echo -n "Testing $script help... "
((TESTS++))
if ./$script -hp >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
}
test_two_char_options() {
local script="$1"
local test_cmd="$2"
echo -n "Testing $script two-char options... "
((TESTS++))
# Test that the script recognizes the two-character option (even if it fails later due to missing data)
if eval "$test_cmd" 2>&1 | grep -q "Unknown option" || eval "$test_cmd" 2>&1 | grep -q "Invalid option"; then
echo -e "${RED}${NC} (Two-character option not recognized)"
else
echo -e "${GREEN}${NC}"
((PASSED++))
fi
}
echo -e "${BLUE}=== Testing Help Functions ===${NC}"
test_help "sf-check"
test_help "sf-deploy"
test_help "sf-dry-run"
test_help "sf-web-open"
test_help "sf-org-create"
test_help "sf-org-info"
test_help "sf-retrieve"
test_help "sf-test-run"
test_help "sf-apex-run"
test_help "sf-data-export"
test_help "sf-data-import"
test_help "sf-logs-tail"
echo ""
echo -e "${BLUE}=== Testing Two-Character Options ===${NC}"
test_two_char_options "sf-deploy" "./sf-deploy -to $TEST_ORG >/dev/null 2>&1 || true"
test_two_char_options "sf-dry-run" "./sf-dry-run -to $TEST_ORG >/dev/null 2>&1 || true"
test_two_char_options "sf-web-open" "./sf-web-open -to $TEST_ORG -ur >/dev/null 2>&1 || true"
test_two_char_options "sf-org-create" "./sf-org-create -al Test >/dev/null 2>&1 || true"
test_two_char_options "sf-data-export" "./sf-data-export -qy 'SELECT Id FROM User LIMIT 1' -to $TEST_ORG >/dev/null 2>&1 || true"
echo ""
echo -e "${BLUE}=== Testing Basic Functionality ===${NC}"
# Test sf-check
echo -n "Testing sf-check basic... "
((TESTS++))
if ./sf-check >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
# Test sf-org-info
echo -n "Testing sf-org-info... "
((TESTS++))
if ./sf-org-info -ls >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
# Test sf-web-open URL mode
echo -n "Testing sf-web-open URL-only... "
((TESTS++))
if ./sf-web-open -to $TEST_ORG -ur >/dev/null 2>&1; then
echo -e "${GREEN}${NC}"
((PASSED++))
else
echo -e "${RED}${NC}"
fi
echo ""
echo -e "${BLUE}=== Quick Test Summary ===${NC}"
echo -e "${BLUE}========================${NC}"
echo "Tests run: $TESTS"
echo -e "${GREEN}Passed: $PASSED${NC}"
echo -e "${RED}Failed: $((TESTS - PASSED))${NC}"
if [[ $PASSED -eq $TESTS ]]; then
echo ""
echo -e "${GREEN}🎉 All quick tests passed!${NC}"
echo -e "${YELLOW}Run ./test-all-wrappers.sh for comprehensive testing.${NC}"
exit 0
else
echo ""
echo -e "${RED}❌ Some quick tests failed.${NC}"
echo -e "${YELLOW}Run ./test-all-wrappers.sh for detailed testing.${NC}"
exit 1
fi