Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
mcpproxy-go/scripts/run-oauth-e2e.sh at main · Xroft12/mcpproxy-go · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Xroft12
mcpproxy-go
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
mcpproxy-go
/
scripts
/
run-oauth-e2e.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
234 lines (204 loc) · 6.61 KB
main
Breadcrumbs
mcpproxy-go
/
scripts
/
run-oauth-e2e.sh
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
234 lines (204 loc) · 6.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!
/bin/bash
#
OAuth E2E Test Runner
#
This script runs the complete OAuth E2E test suite including:
#
1. Go unit tests for the OAuth test server
#
2. Full mcpproxy OAuth flow tests with Playwright
#
#
Test Scenarios (Spec 008):
#
- T047: Token refresh with short TTL
#
- T048: Persisted token loading on restart
#
- T049: Correlation ID verification
#
- T050: Race condition prevention (rapid reconnections)
#
- T051: Error injection (invalid_grant)
#
- T052: Web UI OAuth status verification
#
- T053: REST API OAuth status verification
#
#
Usage:
#
./scripts/run-oauth-e2e.sh # Run all tests
#
./scripts/run-oauth-e2e.sh --short-ttl # Run with 30s token TTL
#
./scripts/run-oauth-e2e.sh --error-injection # Run with error injection tests
#
./scripts/run-oauth-e2e.sh --runlayer-mode # Run with Runlayer mode (Pydantic 422 errors)
#
./scripts/run-oauth-e2e.sh --verbose # Show verbose output
set
-e
#
Colors for output
RED=
'
\033[0;31m
'
GREEN=
'
\033[0;32m
'
YELLOW=
'
\033[1;33m
'
BLUE=
'
\033[0;34m
'
NC=
'
\033[0m
'
#
No Color
#
Parse arguments
SHORT_TTL=false
ERROR_INJECTION=false
RUNLAYER_MODE=false
VERBOSE=false
for
arg
in
"
$@
"
;
do
case
$arg
in
--short-ttl)
SHORT_TTL=true
shift
;;
--error-injection)
ERROR_INJECTION=true
shift
;;
--runlayer-mode)
RUNLAYER_MODE=true
shift
;;
--verbose)
VERBOSE=true
shift
;;
esac
done
#
Configuration
OAUTH_SERVER_PORT=
${OAUTH_SERVER_PORT
:-
9000}
MCPPROXY_PORT=
${MCPPROXY_PORT
:-
8085}
SCRIPT_DIR=
"
$(
cd
"
$(
dirname
"
${BASH_SOURCE[0]}
"
)
"
&&
pwd
)
"
PROJECT_ROOT=
"
$(
dirname
"
$SCRIPT_DIR
"
)
"
PLAYWRIGHT_DIR=
"
$PROJECT_ROOT
/e2e/playwright
"
TEST_CONFIG=
"
$PLAYWRIGHT_DIR
/test-config.json
"
TEST_DATA_DIR=
"
/tmp/mcpproxy-oauth-e2e
"
TEST_RESULTS_DIR=
"
$PLAYWRIGHT_DIR
/test-results
"
#
Token TTL for short TTL mode (T047)
if
[
"
$SHORT_TTL
"
=
true
]
;
then
ACCESS_TOKEN_TTL=
"
30s
"
else
ACCESS_TOKEN_TTL=
"
1h
"
fi
#
PIDs for cleanup
OAUTH_SERVER_PID=
"
"
MCPPROXY_PID=
"
"
cleanup
() {
echo
"
"
echo
-e
"
${YELLOW}
Cleaning up...
${NC}
"
if
[
-n
"
$MCPPROXY_PID
"
]
&&
kill
-0
"
$MCPPROXY_PID
"
2>
/dev/null
;
then
echo
"
Stopping mcpproxy (PID:
$MCPPROXY_PID
)
"
kill
"
$MCPPROXY_PID
"
2>
/dev/null
||
true
wait
"
$MCPPROXY_PID
"
2>
/dev/null
||
true
fi
if
[
-n
"
$OAUTH_SERVER_PID
"
]
&&
kill
-0
"
$OAUTH_SERVER_PID
"
2>
/dev/null
;
then
echo
"
Stopping OAuth server (PID:
$OAUTH_SERVER_PID
)
"
kill
"
$OAUTH_SERVER_PID
"
2>
/dev/null
||
true
wait
"
$OAUTH_SERVER_PID
"
2>
/dev/null
||
true
fi
#
Kill any remaining processes on our ports
lsof -ti :
$OAUTH_SERVER_PORT
|
xargs
kill
-9
2>
/dev/null
||
true
lsof -ti :
$MCPPROXY_PORT
|
xargs
kill
-9
2>
/dev/null
||
true
#
Clean up test data
rm -rf
"
$TEST_DATA_DIR
"
2>
/dev/null
||
true
echo
"
Cleanup complete
"
}
trap
cleanup EXIT
echo
"
==========================================
"
echo
"
OAuth E2E Test Suite
"
echo
"
==========================================
"
echo
"
"
echo
"
Configuration:
"
echo
"
OAuth Server Port:
$OAUTH_SERVER_PORT
"
echo
"
MCPProxy Port:
$MCPPROXY_PORT
"
echo
"
Test Data Dir:
$TEST_DATA_DIR
"
echo
"
"
#
Track failures
FAILURES=0
#
Run Go unit tests for OAuth test server
echo
-e
"
${YELLOW}
Running OAuth test server unit tests...
${NC}
"
cd
"
$PROJECT_ROOT
"
if
go
test
./tests/oauthserver/... -v -count=1
2>&1
|
tail -30
;
then
echo
-e
"
${GREEN}
✅ OAuth test server tests passed
${NC}
"
else
echo
-e
"
${RED}
❌ OAuth test server tests failed
${NC}
"
FAILURES=
$((
FAILURES
+
1
))
fi
echo
"
"
#
Check if Playwright is available
if
[
!
-d
"
$PLAYWRIGHT_DIR
"
]
||
[
!
-f
"
$PLAYWRIGHT_DIR
/package.json
"
]
;
then
echo
-e
"
${YELLOW}
⚠️ Playwright tests not available (e2e/playwright not found)
${NC}
"
echo
"
"
echo
"
==========================================
"
echo
"
Test Summary
"
echo
"
==========================================
"
if
[
$FAILURES
-eq
0 ]
;
then
echo
-e
"
${GREEN}
✅ All tests passed!
${NC}
"
exit
0
else
echo
-e
"
${RED}
❌
$FAILURES
test suite(s) failed
${NC}
"
exit
1
fi
fi
#
Ensure Playwright dependencies are installed
echo
-e
"
${YELLOW}
Checking Playwright setup...
${NC}
"
cd
"
$PLAYWRIGHT_DIR
"
if
[
!
-d
"
node_modules
"
]
;
then
echo
"
Installing Playwright dependencies...
"
npm install
npx playwright install chromium
fi
cd
"
$PROJECT_ROOT
"
#
Build mcpproxy
echo
-e
"
${YELLOW}
Building mcpproxy...
${NC}
"
go build -o /tmp/mcpproxy-e2e ./cmd/mcpproxy
echo
-e
"
${GREEN}
✅ mcpproxy built
${NC}
"
echo
"
"
#
Create test data directory
mkdir -p
"
$TEST_DATA_DIR
"
#
Create test results directory
mkdir -p
"
$TEST_RESULTS_DIR
"
#
Start OAuth test server with configured TTL
echo
-e
"
${YELLOW}
Starting OAuth test server on port
$OAUTH_SERVER_PORT
...
${NC}
"
echo
-e
"
${BLUE}
Access Token TTL:
$ACCESS_TOKEN_TTL
${NC}
"
#
Build OAuth server command
OAUTH_SERVER_CMD=
"
go run ./tests/oauthserver/cmd/server -port
$OAUTH_SERVER_PORT
-access-token-ttl=
$ACCESS_TOKEN_TTL
"
if
[
"
$RUNLAYER_MODE
"
=
true
]
;
then
OAUTH_SERVER_CMD=
"
$OAUTH_SERVER_CMD
-runlayer-mode
"
echo
-e
"
${BLUE}
Runlayer Mode: enabled (Pydantic 422 errors)
${NC}
"
fi
$OAUTH_SERVER_CMD
&
OAUTH_SERVER_PID=
$!
sleep 3
#
Verify OAuth server is running
if
!
curl -s
"
http://127.0.0.1:
$OAUTH_SERVER_PORT
/jwks.json
"
>
/dev/null
;
then
echo
-e
"
${RED}
❌ Failed to start OAuth test server
${NC}
"
exit
1
fi
echo
-e
"
${GREEN}
✅ OAuth test server started
${NC}
"
echo
"
"
#
Start mcpproxy with test config
echo
-e
"
${YELLOW}
Starting mcpproxy on port
$MCPPROXY_PORT
...
${NC}
"
MCPPROXY_API_KEY=
"
test-api-key
"
/tmp/mcpproxy-e2e serve --config=
"
$TEST_CONFIG
"
&
MCPPROXY_PID=
$!
sleep 3
#
Verify mcpproxy is running
if
!
curl -s -H
"
X-API-Key: test-api-key
"
"
http://127.0.0.1:
$MCPPROXY_PORT
/api/v1/status
"
>
/dev/null
;
then
echo
-e
"
${RED}
❌ Failed to start mcpproxy
${NC}
"
exit
1
fi
echo
-e
"
${GREEN}
✅ mcpproxy started
${NC}
"
echo
"
"
#
Run Playwright tests
echo
-e
"
${YELLOW}
Running Playwright OAuth flow tests...
${NC}
"
cd
"
$PLAYWRIGHT_DIR
"
OAUTH_SERVER_URL=
"
http://127.0.0.1:
$OAUTH_SERVER_PORT
"
\
OAUTH_CLIENT_ID=
"
test-client
"
\
MCPPROXY_URL=
"
http://127.0.0.1:
$MCPPROXY_PORT
"
\
MCPPROXY_API_KEY=
"
test-api-key
"
\
npx playwright
test
--reporter=list
||
{
echo
-e
"
${RED}
❌ Playwright tests failed
${NC}
"
FAILURES=
$((
FAILURES
+
1
))
}
cd
"
$PROJECT_ROOT
"
if
[
$FAILURES
-eq
0 ]
;
then
echo
-e
"
${GREEN}
✅ Playwright tests passed
${NC}
"
fi
echo
"
"
#
Summary
echo
"
==========================================
"
echo
"
Test Summary
"
echo
"
==========================================
"
if
[
$FAILURES
-eq
0 ]
;
then
echo
-e
"
${GREEN}
✅ All tests passed!
${NC}
"
exit
0
else
echo
-e
"
${RED}
❌
$FAILURES
test suite(s) failed
${NC}
"
exit
1
fi
You can’t perform that action at this time.