Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/additional_edge_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if [ -d "$PROJECT_DIR/src" ]; then
fi
TM="./tm"

# Ensure orchestration enforcement allows non-interactive test commands.
export TM_AGENT_ID="test_suite_agent"

TEST_COUNT=0
PASS_COUNT=0

Expand All @@ -65,7 +68,7 @@ cleanup() {
# Add delay for WSL
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

cd "$SAVED_DIR" 2>/dev/null || cd /tmp
Expand Down
3 changes: 1 addition & 2 deletions tests/run_all_tests_safe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ run_test_safe() {
if [ $IS_WSL -eq 1 ]; then
echo "Waiting 2 seconds before next test (WSL safety)..."
sleep 2
sync
else
sleep 0.5
fi
Expand Down Expand Up @@ -163,4 +162,4 @@ if [ $FAILED_TESTS -eq 0 ] && [ $PASSED_TESTS -gt 0 ]; then
else
echo -e "${RED}Some tests failed. Please review the results.${NC}"
exit 1
fi
fi
21 changes: 15 additions & 6 deletions tests/stress_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if [ -d "$PROJECT_DIR/src" ]; then
fi
TM="./tm"

# Ensure orchestration enforcement allows non-interactive stress commands.
export TM_AGENT_ID="test_suite_agent"

TEST_COUNT=0
PASS_COUNT=0
FAIL_COUNT=0
Expand All @@ -67,7 +70,7 @@ cleanup() {
# Add delay for WSL
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

cd "$SAVED_DIR" 2>/dev/null || cd /tmp
Expand All @@ -88,10 +91,16 @@ function stress_test() {
local END_TIME=$(date +%s.%N)
local DURATION=$(echo "$END_TIME - $START_TIME" | bc -l)

# Check if completed within reasonable time (adjust as needed)
if (( $(echo "$DURATION < 10.0" | bc -l) )); then
# WSL is slower under filesystem-heavy loops; use a higher threshold there.
local DURATION_LIMIT="10.0"
if [ $IS_WSL -eq 1 ]; then
DURATION_LIMIT="30.0"
fi

# Check if completed within reasonable time.
if (( $(echo "$DURATION < $DURATION_LIMIT" | bc -l) )); then
if [ -n "$EXPECTED_COUNT" ]; then
local ACTUAL_COUNT=$($TM list | grep -c "○\|◐\|●\|⊘\|✗")
local ACTUAL_COUNT=$($TM export --format json 2>/dev/null | grep -o '"id"' | wc -l | tr -d ' ')
if [ $ACTUAL_COUNT -ge $EXPECTED_COUNT ]; then
echo "PASS (${DURATION}s, $ACTUAL_COUNT tasks)"
PASS_COUNT=$((PASS_COUNT + 1))
Expand Down Expand Up @@ -303,7 +312,7 @@ echo "╔═══════════════════════
echo "║ STRESS TEST SUMMARY ║"
echo "╚══════════════════════════════════════════════════════╝"

TOTAL_TASKS=$($TM list | grep -c "○\|◐\|●\|⊘\|✗" 2>/dev/null || echo 0)
TOTAL_TASKS=$($TM export --format json 2>/dev/null | grep -o '"id"' | wc -l | tr -d ' ' || echo 0)
echo "Total tasks created: $TOTAL_TASKS"
echo "Total stress tests: $TEST_COUNT"
echo "Passed: $PASS_COUNT"
Expand All @@ -322,4 +331,4 @@ else
fi

# Cleanup is handled by trap
exit $EXIT_CODE
exit $EXIT_CODE
1 change: 1 addition & 0 deletions tests/test_agent_specialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if [ -d "$PROJECT_DIR/src" ]; then
fi
chmod +x ./tm
TM="./tm"
export TM_AGENT_ID="test_suite_agent"

echo -e "${BLUE}===================================${NC}"
echo -e "${BLUE} Agent Specialization Tests ${NC}"
Expand Down
1 change: 1 addition & 0 deletions tests/test_collaboration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ else
fi

chmod +x tm
export TM_AGENT_ID="test_suite_agent"

echo -e "${BLUE}===================================${NC}"
echo -e "${BLUE} Collaboration Features Tests ${NC}"
Expand Down
7 changes: 4 additions & 3 deletions tests/test_context_sharing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ setup() {
fi
TM="./tm"
chmod +x "$TM"
export TM_AGENT_ID="test_suite_agent"

# Add WSL-specific delay for filesystem sync
# Add WSL-specific delay without host-wide sync (can hang on mounted filesystems)
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

git init > /dev/null 2>&1
Expand Down Expand Up @@ -103,7 +104,7 @@ cleanup() {
# Add delay for WSL
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

cd / 2>/dev/null || cd /tmp
Expand Down
9 changes: 5 additions & 4 deletions tests/test_durability.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if [ -d "$PROJECT_DIR/src" ]; then
fi
chmod +x ./tm
TM="./tm"
export TM_AGENT_ID="test_suite_agent"

echo -e "${BLUE}===================================${NC}"
echo -e "${BLUE} Durability & Resilience Tests ${NC}"
Expand Down Expand Up @@ -83,8 +84,8 @@ test_basic_persistence() {
# Backup database
cp .task-orchestrator/tasks.db .task-orchestrator/tasks.db.backup

# Simulate restart by clearing any cache (if exists)
sync
# Simulate restart without calling host-wide sync (can hang on mounted filesystems).
sleep 0.1

# Verify data persists
$TM show $TASK1 | grep -q "in_progress" && \
Expand Down Expand Up @@ -191,8 +192,8 @@ test_wal_recovery() {
# Create tasks
TASK=$($TM add "WAL test task" | grep -o '[a-f0-9]\{8\}')

# Force checkpoint
sync
# Force checkpoint simulation without host-wide sync.
sleep 0.1

# Verify WAL files exist (if WAL enabled)
if [ -f .task-orchestrator/tasks.db-wal ]; then
Expand Down
5 changes: 4 additions & 1 deletion tests/test_edge_cases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ if [ -d "$PROJECT_DIR/src" ]; then
fi
TM="./tm"

# Ensure orchestration enforcement allows non-interactive test commands.
export TM_AGENT_ID="test_suite_agent"

TEST_COUNT=0
PASS_COUNT=0
FAIL_COUNT=0
Expand All @@ -67,7 +70,7 @@ cleanup() {
# Add delay for WSL
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

cd "$SAVED_DIR" 2>/dev/null || cd /tmp
Expand Down
13 changes: 8 additions & 5 deletions tests/test_tm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ fi
echo "Running tests in isolated directory: $TEST_DIR"
cd "$TEST_DIR"

# Add WSL-specific delay for filesystem sync
# Add WSL-specific delay without host-wide sync (can hang on mounted filesystems)
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

# Find tm executable safely
Expand All @@ -54,6 +54,9 @@ if [ -d "$PROJECT_DIR/src" ]; then
fi
TM="./tm"

# Ensure orchestration enforcement allows non-interactive test commands.
export TM_AGENT_ID="test_suite_agent"

# Set environment variables for WSL safety
if [ $IS_WSL -eq 1 ]; then
export SQLITE_TMPDIR="$TEST_DIR"
Expand All @@ -71,10 +74,10 @@ cleanup() {
# Kill any remaining tm processes
pkill -f "tm.*$TEST_DIR" 2>/dev/null || true

# Add delay for WSL
# Add delay for WSL without host-wide sync
if [ $IS_WSL -eq 1 ]; then
sleep 0.5
sync
sleep 0.1
fi

cd "$SAVED_DIR" 2>/dev/null || cd /tmp
Expand Down Expand Up @@ -319,4 +322,4 @@ else
fi

# Cleanup is handled by trap
exit $EXIT_CODE
exit $EXIT_CODE