Skip to content

Commit 784bec2

Browse files
janiszclaudemtodor
authored
Add E2E tests to CI with PR comment reporting (#49)
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Mladen Todorovic <mtodor@gmail.com>
1 parent ce91d76 commit 784bec2

3 files changed

Lines changed: 123 additions & 4 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: E2E Tests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
10+
# Cancel in-progress runs for the same PR when new commits are pushed
11+
concurrency:
12+
group: e2e-${{ github.event.pull_request.number }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
e2e:
17+
name: Run E2E Tests
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
pull-requests: write
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version-file: go.mod
31+
32+
- name: Setup proto files
33+
run: make proto-setup
34+
35+
- name: Generate proto descriptors
36+
run: make proto-generate
37+
38+
- name: Download WireMock
39+
run: make mock-download
40+
41+
- name: Run E2E tests
42+
env:
43+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
44+
MODEL_KEY: ${{ secrets.OPENAI_API_KEY }}
45+
run: make e2e-test
46+
47+
- name: Parse test results
48+
if: always()
49+
id: parse_results
50+
run: |
51+
RESULTS_FILE="e2e-tests/mcpchecker/mcpchecker-stackrox-mcp-e2e-out.json"
52+
if [ -f "$RESULTS_FILE" ]; then
53+
cd e2e-tests/mcpchecker
54+
55+
# Get stats in GitHub Actions format
56+
../../e2e-tests/bin/mcpchecker summary mcpchecker-stackrox-mcp-e2e-out.json --github-output >> $GITHUB_OUTPUT
57+
58+
# Get human-readable summary for PR comment
59+
SUMMARY=$(../../e2e-tests/bin/mcpchecker summary mcpchecker-stackrox-mcp-e2e-out.json)
60+
echo "summary<<EOF" >> $GITHUB_OUTPUT
61+
echo "$SUMMARY" >> $GITHUB_OUTPUT
62+
echo "EOF" >> $GITHUB_OUTPUT
63+
64+
# Add to GitHub Actions step summary
65+
echo "## E2E Test Results" >> $GITHUB_STEP_SUMMARY
66+
echo "" >> $GITHUB_STEP_SUMMARY
67+
echo '```' >> $GITHUB_STEP_SUMMARY
68+
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY
69+
echo '```' >> $GITHUB_STEP_SUMMARY
70+
else
71+
echo "total=0" >> $GITHUB_OUTPUT
72+
echo "passed=0" >> $GITHUB_OUTPUT
73+
echo "failed=0" >> $GITHUB_OUTPUT
74+
echo "summary=No results file found" >> $GITHUB_OUTPUT
75+
fi
76+
77+
- name: Find existing comment
78+
if: always()
79+
uses: peter-evans/find-comment@v3
80+
id: find_comment
81+
with:
82+
issue-number: ${{ github.event.pull_request.number }}
83+
comment-author: 'github-actions[bot]'
84+
body-includes: '<!-- e2e-test-results -->'
85+
86+
- name: Create or update comment - Success
87+
if: success()
88+
uses: peter-evans/create-or-update-comment@v4
89+
with:
90+
comment-id: ${{ steps.find_comment.outputs.comment-id }}
91+
issue-number: ${{ github.event.pull_request.number }}
92+
edit-mode: replace
93+
body: |
94+
<!-- e2e-test-results -->
95+
## E2E Test Results
96+
97+
**Commit:** ${{ github.event.pull_request.head.sha }}
98+
**Workflow Run:** [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
99+
100+
```
101+
${{ steps.parse_results.outputs.summary }}
102+
```
103+
104+
- name: Create or update comment - Failure
105+
if: failure()
106+
uses: peter-evans/create-or-update-comment@v4
107+
with:
108+
comment-id: ${{ steps.find_comment.outputs.comment-id }}
109+
issue-number: ${{ github.event.pull_request.number }}
110+
edit-mode: replace
111+
body: |
112+
<!-- e2e-test-results -->
113+
## E2E Test Results - ❌ Job Failed
114+
115+
**Commit:** ${{ github.event.pull_request.head.sha }}
116+
**Workflow Run:** [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})

e2e-tests/mcpchecker/eval.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ metadata:
33
name: "stackrox-mcp-e2e"
44
config:
55
agent:
6-
type: "builtin.claude-code"
7-
model: "claude-sonnet-4-5"
6+
type: "builtin.openai-agent"
7+
model: "gpt-5-nano"
88
llmJudge:
99
env:
1010
typeKey: JUDGE_TYPE

e2e-tests/scripts/run-tests.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ if [ ! -f "$E2E_DIR/bin/mcpchecker" ]; then
5858
fi
5959

6060

61-
# Set agent model (defaults to claude-sonnet-4-5)
62-
export AGENT_MODEL_NAME="${AGENT_MODEL_NAME:-claude-sonnet-4-5}"
61+
# Set agent environment variables (use OpenAI)
62+
export MODEL_BASE_URL="${MODEL_BASE_URL:-https://api.openai.com/v1}"
63+
export MODEL_KEY="${MODEL_KEY:-$OPENAI_API_KEY}"
64+
export MODEL_NAME="${MODEL_NAME:-gpt-5-nano}"
6365

6466
# Set judge environment variables (use OpenAI)
6567
export JUDGE_BASE_URL="${JUDGE_BASE_URL:-https://api.openai.com/v1}"
@@ -68,6 +70,7 @@ export JUDGE_MODEL_NAME="${JUDGE_MODEL_NAME:-gpt-5-nano}"
6870

6971
echo "Configuration:"
7072
echo " Central URL: $STACKROX_MCP__CENTRAL__URL (WireMock)"
73+
echo " Agent: $MODEL_NAME (OpenAI)"
7174
echo " Judge: $JUDGE_MODEL_NAME (OpenAI)"
7275
echo " MCP Server: stackrox-mcp (via go run)"
7376
echo ""

0 commit comments

Comments
 (0)