Skip to content

Commit bfab5aa

Browse files
committed
cleaning up
1 parent 95401c0 commit bfab5aa

File tree

3 files changed

+26
-142
lines changed

3 files changed

+26
-142
lines changed

.github/workflows/agentex-tutorials-test.yml

Lines changed: 8 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
all_tutorials=$(find . -name "manifest.yaml" -exec dirname {} \; | sort | sed 's|^\./||')
2121
2222
# Filter out the specified temporal tutorials that are being updated
23-
filtered_tutorials=$(echo "$all_tutorials" | grep -v -E "(10_temporal/050_|10_temporal/070_|10_temporal/080_)")
23+
filtered_tutorials=$(echo "$all_tutorials" | grep -v -E "(temporal)")
2424
2525
# Convert to JSON array
2626
tutorials=$(echo "$filtered_tutorials" | jq -R -s -c 'split("\n") | map(select(length > 0))')
@@ -119,155 +119,26 @@ jobs:
119119
AGENTEX_API_BASE_URL="http://localhost:5003" \
120120
./run_agent_test.sh --build-cli "${{ matrix.tutorial }}"
121121
122-
- name: Upload Test Results
122+
- name: Record test result
123+
id: test-result
123124
if: always()
124125
run: |
125-
# Sanitize tutorial name for artifact upload
126-
SANITIZED_NAME=$(echo "${{ matrix.tutorial }}" | sed 's/\//-/g')
127-
echo "Uploading test results for: ${{ matrix.tutorial }} (as: test-results-$SANITIZED_NAME)"
128-
129-
# Create a temporary directory with the sanitized name
130-
mkdir -p "test-results-$SANITIZED_NAME"
131-
cp /tmp/agentex-*.log "test-results-$SANITIZED_NAME/" 2>/dev/null || echo "No log files to copy"
132-
133-
# Upload using the actions/upload-artifact action
134-
echo "artifact-name=test-results-$SANITIZED_NAME" >> $GITHUB_ENV
135-
136-
- name: Upload Artifact
137-
if: always()
138-
uses: actions/upload-artifact@v4
139-
with:
140-
name: ${{ env.artifact-name }}
141-
path: test-results-*
142-
retention-days: 1
126+
if [ "${{ steps.run-test.outcome }}" == "success" ]; then
127+
echo "result=passed" >> $GITHUB_OUTPUT
128+
else
129+
echo "result=failed" >> $GITHUB_OUTPUT
130+
fi
143131
144132
test-summary:
145133
if: always()
146134
needs: [find-tutorials, test-tutorial]
147135
runs-on: ubuntu-latest
148136
name: Test Summary
149137
steps:
150-
- name: Download All Test Results
151-
uses: actions/download-artifact@v4
152-
with:
153-
path: test-results
154-
pattern: test-results-*
155-
156138
- name: Generate Test Summary
157139
run: |
158140
echo "# 🧪 Tutorial Tests Summary" >> $GITHUB_STEP_SUMMARY
159141
echo "" >> $GITHUB_STEP_SUMMARY
160142
161143
# Get tutorial list from needs context
162144
tutorials='${{ needs.find-tutorials.outputs.tutorials }}'
163-
164-
# Debug: Show what we're working with
165-
echo "🔍 DEBUG: Tutorial list from find-tutorials job:"
166-
echo "$tutorials"
167-
echo ""
168-
echo "🔍 DEBUG: Downloaded artifacts:"
169-
ls -la test-results/ || echo "No test-results directory found"
170-
echo ""
171-
echo "🔍 DEBUG: Artifact contents:"
172-
find test-results/ -type f -name "*.log" || echo "No log files found"
173-
echo ""
174-
175-
# Initialize counters
176-
total_tutorials=0
177-
passed_tutorials=0
178-
failed_tutorials=0
179-
180-
# Arrays to track results
181-
passed_tests=()
182-
failed_tests=()
183-
184-
echo "## 📊 Overall Results" >> $GITHUB_STEP_SUMMARY
185-
echo "" >> $GITHUB_STEP_SUMMARY
186-
187-
# Process each tutorial result
188-
for tutorial_dir in test-results/test-results-*/; do
189-
if [ -d "$tutorial_dir" ]; then
190-
# Extract sanitized name and convert back to original tutorial path
191-
sanitized_name=$(basename "$tutorial_dir" | sed 's/test-results-//')
192-
tutorial_name=$(echo "$sanitized_name" | sed 's/-/\//g')
193-
total_tutorials=$((total_tutorials + 1))
194-
195-
# Check if there are any log files in this directory
196-
if find "$tutorial_dir" -name "*.log" -type f | grep -q .; then
197-
# Determine success/failure based on pytest-specific failure patterns
198-
if find "$tutorial_dir" -name "*.log" -exec grep -l "FAILED.*::" {} \; | head -1 >/dev/null || \
199-
find "$tutorial_dir" -name "*.log" -exec grep -l "=== FAILURES ===" {} \; | head -1 >/dev/null || \
200-
find "$tutorial_dir" -name "*.log" -exec grep -l "AssertionError" {} \; | head -1 >/dev/null; then
201-
failed_tutorials=$((failed_tutorials + 1))
202-
failed_tests+=("$tutorial_name")
203-
else
204-
passed_tutorials=$((passed_tutorials + 1))
205-
passed_tests+=("$tutorial_name")
206-
fi
207-
fi
208-
fi
209-
done
210-
211-
# Show summary stats
212-
echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY
213-
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
214-
echo "| ✅ **Passed** | **$passed_tutorials** |" >> $GITHUB_STEP_SUMMARY
215-
echo "| ❌ **Failed** | **$failed_tutorials** |" >> $GITHUB_STEP_SUMMARY
216-
echo "| 📊 **Total** | **$total_tutorials** |" >> $GITHUB_STEP_SUMMARY
217-
echo "" >> $GITHUB_STEP_SUMMARY
218-
219-
# Show passed tests
220-
if [ $passed_tutorials -gt 0 ]; then
221-
echo "## ✅ Passed Tutorials ($passed_tutorials)" >> $GITHUB_STEP_SUMMARY
222-
echo "" >> $GITHUB_STEP_SUMMARY
223-
for test in "${passed_tests[@]}"; do
224-
echo "- ✅ \`$test\`" >> $GITHUB_STEP_SUMMARY
225-
done
226-
echo "" >> $GITHUB_STEP_SUMMARY
227-
fi
228-
229-
# Show pytest failures only for failed tests
230-
if [ $failed_tutorials -gt 0 ]; then
231-
echo "## ❌ Failed Tutorials ($failed_tutorials)" >> $GITHUB_STEP_SUMMARY
232-
echo "" >> $GITHUB_STEP_SUMMARY
233-
echo '```' >> $GITHUB_STEP_SUMMARY
234-
235-
# Extract and append pytest failures from each failed test
236-
for test in "${failed_tests[@]}"; do
237-
# Find the log file for this test (convert back to sanitized name)
238-
sanitized_test_name=$(echo "$test" | sed 's/\//-/g')
239-
log_file=$(find "test-results/test-results-$sanitized_test_name" -name "*.log" | head -1)
240-
if [ -f "$log_file" ]; then
241-
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
242-
echo "FAILED: $test" >> $GITHUB_STEP_SUMMARY
243-
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
244-
245-
# Extract pytest output between the delimiters, or show pytest summary if no delimiters
246-
if grep -q "========== PYTEST OUTPUT ==========" "$log_file"; then
247-
sed -n '/========== PYTEST OUTPUT ==========/,/========== END PYTEST OUTPUT ==========/p' "$log_file" | \
248-
sed '1d;$d' >> $GITHUB_STEP_SUMMARY
249-
else
250-
# If no delimiters, try to extract pytest-related lines
251-
grep -E "(FAILED|ERROR|AssertionError|collected.*items|=====.*=====|::.*FAILED)" "$log_file" >> $GITHUB_STEP_SUMMARY || \
252-
echo "No pytest output found in log file" >> $GITHUB_STEP_SUMMARY
253-
fi
254-
echo "" >> $GITHUB_STEP_SUMMARY
255-
else
256-
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
257-
echo "FAILED: $test (No log file found)" >> $GITHUB_STEP_SUMMARY
258-
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
259-
echo "" >> $GITHUB_STEP_SUMMARY
260-
fi
261-
done
262-
263-
echo '```' >> $GITHUB_STEP_SUMMARY
264-
echo "" >> $GITHUB_STEP_SUMMARY
265-
fi
266-
267-
# Set exit code based on results
268-
if [ $failed_tutorials -gt 0 ]; then
269-
echo "❌ Some tutorials failed. Check the details above." >> $GITHUB_STEP_SUMMARY
270-
exit 1
271-
else
272-
echo "🎉 All tutorials passed successfully!" >> $GITHUB_STEP_SUMMARY
273-
fi

examples/tutorials/10_agentic/00_base/040_other_sdks/tests/test_agent.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, agen
114114
break
115115

116116
# Verify state has been updated by polling the states for 10 seconds
117-
for i in range(10):
117+
for i in range(20):
118118
if i == 9:
119119
raise Exception("Timeout waiting for state updates")
120120
states = await client.states.list(agent_id=agent_id, task_id=task.id)
@@ -187,7 +187,12 @@ async def test_multi_turn_conversation_with_state(self, client: AsyncAgentex, ag
187187
sleep_interval=1.0,
188188
):
189189
assert isinstance(message, TaskMessage)
190-
if message.content and message.content.type == "text" and message.content.author == "agent" and message.content.content:
190+
if (
191+
message.content
192+
and message.content.type == "text"
193+
and message.content.author == "agent"
194+
and message.content.content
195+
):
191196
break
192197

193198
## keep polling the states for 10 seconds for the input_list and turn_number to be updated
@@ -216,7 +221,12 @@ async def test_multi_turn_conversation_with_state(self, client: AsyncAgentex, ag
216221
timeout=30,
217222
sleep_interval=1.0,
218223
):
219-
if message.content and message.content.type == "text" and message.content.author == "agent" and message.content.content:
224+
if (
225+
message.content
226+
and message.content.type == "text"
227+
and message.content.author == "agent"
228+
and message.content.content
229+
):
220230
response_text = message.content.content.lower()
221231
assert "blue" in response_text
222232
found_response = True
@@ -273,7 +283,10 @@ async def stream_messages() -> None:
273283
# For full messages, content is at the top level
274284
# For delta messages, we need to check parent_task_message
275285
if msg_type == "full":
276-
if event.get("content", {}).get("type") == "text" and event.get("content", {}).get("author") == "user":
286+
if (
287+
event.get("content", {}).get("type") == "text"
288+
and event.get("content", {}).get("author") == "user"
289+
):
277290
user_message_found = True
278291
elif msg_type == "done":
279292
break

examples/tutorials/run_agent_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ run_test() {
263263

264264

265265
# Run the tests with retry mechanism
266-
local max_retries=3
266+
local max_retries=5
267267
local retry_count=0
268268
local exit_code=1
269269

0 commit comments

Comments
 (0)