Skip to content

Conversation

@alocay
Copy link
Contributor

@alocay alocay commented Sep 2, 2025

Adding some basic e2e tests using mcp-server-tester. Currently the tool does not always exit (ctrl+c is sometimes needed) so this should be run manually.

How to run tests?

Added a script run_tests.sh (may need to run chmod +x to run it) to run tests. Basic usage found via ./run_tests.sh -h. The script does the following:

  1. Builds test/config yaml paths and verifies the files exist.
  2. Checks if release apollo-mcp-server binary exists. If not, it builds the binary via cargo build --release.
  3. Reads in the template file (used by mcp-server-tester) and replaces all <test-dir> placeholders with the test directory value. Generates this test server config file and places it in a temp location.
  4. Invokes the mcp-server-tester via npx.
  5. On script exit the generated config is cleaned up.

Example run:

To run the tests for local-operations simply run ./run_tests.sh local-operations

@alocay alocay requested a review from a team as a code owner September 2, 2025 16:32
@apollo-librarian
Copy link

apollo-librarian bot commented Sep 2, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 01a47c523d5cdcf685c6f73c
Build Logs: View logs

@github-actions
Copy link

github-actions bot commented Sep 2, 2025

Changeset file missing for PR

All changes should include an associated changeset file.
Please refer to README for more information on generating changesets.

5. On script exit the generated config is cleaned up.

### Example run:
To run the tests for `local-operations` simply run `./run_tests.sh local-operations`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slight improvement suggestion. It might be nice if ./run_tests.sh by default runs all the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could but the problem is the mcp-server-tester sometimes doesn't exit. This would hang the script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking the issue here for future reference. steviec/mcp-server-tester#30

@@ -0,0 +1,21 @@
endpoint: https://thespacedevs-production.up.railway.app/
transport:
type: stdio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this test suite eventually support other transports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, currently it does not work with streamable-http.

@@ -0,0 +1,65 @@
tools:
expected_tool_list: ['introspect', 'execute', 'search', 'validate', 'SearchUpcomingLaunches', 'ExploreCelestialBodies', 'GetAstronautDetails', 'GetAstronautsCurrentlyInSpace']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be feasible to actually call one of the graphql operation tools in this first round of tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can add a test for that. It would just be like the tests below, but calling something like SearchUpcomingLaunches instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see if I can add one in a follow up PR

@alocay alocay requested a review from swcollard September 2, 2025 19:42
sed "s|<test-dir>|$safe_dir|g" "$TEMPLATE_PATH" > "$GEN_CONFIG"

# Run the command
exec npx -y mcp-server-tester tools "$TESTS" --server-config "$GEN_CONFIG" No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last question, what does exec provide here when you can also run npx directly in the bash script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you'r eright, this should not use exec. the trap will not work if this is exec.

@alocay alocay merged commit 93bcfff into develop Sep 2, 2025
8 checks passed
@alocay alocay deleted the gt-364-add-basic-e2e-test branch September 2, 2025 20:02
This was referenced Sep 3, 2025
@alocay alocay mentioned this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants