Skip to content

Commit cd792b8

Browse files
committed
Scripts for running integ tests
1 parent f0a3bae commit cd792b8

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
e2e_tests/integ-test-id
2+
13
# CDK asset staging directory
24
.cdk.staging
35
cdk.out

e2e_tests/clean_up_integ_test.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Fail if the file does not exist
6+
if [ ! -f e2e_tests/integ-test-id ]; then
7+
echo "File e2e_tests/integ-test-id does not exist."
8+
exit 1
9+
fi
10+
11+
# Read the integ test ID from the file
12+
export INTEG_TEST_ID=$(cat e2e_tests/integ-test-id)
13+
14+
# Clean up CloudFormation stacks
15+
cd examples/servers/time
16+
cdk destroy --force --app 'python3 cdk_stack.py'
17+
18+
cd ../weather-alerts/
19+
cdk destroy --force --app 'node lib/weather-alerts-mcp-server.js'

e2e_tests/run_integ_test.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Get UUID to make the CloudFormation stacks unique per run
6+
UUID=$(uuidgen)
7+
export INTEG_TEST_ID=$UUID
8+
echo $INTEG_TEST_ID > ./e2e_tests/integ-test-id
9+
10+
# Deploy Python-based example MCP server
11+
cd examples/servers/time
12+
uv pip install -r requirements.txt
13+
cdk deploy --app 'python3 cdk_stack.py'
14+
15+
# Deploy Typescript-based example MCP server
16+
cd ../../../src/typescript/
17+
npm ci
18+
npm run build
19+
npm link
20+
21+
cd ../../examples/servers/weather-alerts/
22+
npm ci
23+
npm link mcp-lambda
24+
npm run build
25+
cdk deploy --app 'node lib/weather-alerts-mcp-server.js'
26+
27+
# Configure integ tests
28+
cd ../../../e2e_tests/
29+
sed -i "s/INTEG_TEST_ID/$INTEG_TEST_ID/g" servers_config.integ.json
30+
cp servers_config.integ.json python/servers_config.json
31+
cp servers_config.integ.json typescript/servers_config.json
32+
33+
# Run the Python integ test
34+
cd python/
35+
uv pip install -r requirements.txt
36+
python main.py
37+
38+
# Run the Typescript integ test
39+
cd ../typescript/
40+
npm ci
41+
npm link mcp-lambda
42+
npm run build
43+
npm test

e2e_tests/servers_config.integ.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"stdioServers": {
3+
"fetch": {
4+
"command": "uvx",
5+
"args": ["mcp-server-fetch"]
6+
}
7+
},
8+
"lambdaFunctionServers": {
9+
"time": {
10+
"functionName": "mcp-server-time-270da139-6074-41ab-b786-8786899ba553",
11+
"region": "us-east-2"
12+
},
13+
"weatherAlerts": {
14+
"functionName": "mcp-server-weather-alerts-270da139-6074-41ab-b786-8786899ba553",
15+
"region": "us-east-2"
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)