Skip to content

Add integration tests.yml for hello and host-details functions - #137

Merged
mraible merged 8 commits into
mainfrom
add-hello-tests-yml
Oct 14, 2026
Merged

mraible merged 8 commits into
mainfrom
add-hello-tests-yml

Conversation

@mraible

@mraible mraible commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Adds tests.yml files for the hello and host-details functions, so the foundry functions test command (CLI 2.1.0+) has integration tests to run against the deployed functions.

functions/hello/tests.yml is self-contained. valid_name sends {"name": "Foundry"} and expects a 200 with the greeting, and missing_name sends {} and expects a 400 with "missing name from request body". Anyone who clones and deploys can run foundry functions test --function hello right away.

functions/host-details/tests.yml exercises a handler that calls the Hosts API through FalconPy. missing_host_id expects a 400 from the handler's own check, and invalid_host_id expects a 400 because the Hosts API rejects a malformed device ID as a bad request. valid_host_id uses a YOUR_HOST_AID_HERE placeholder that you replace with a host ID from your tenant. Because FalconPy's context-aware authentication needs an installed app, the two cases that reach the API return a 403 (app is not installed) until the app is released and installed once. After that, later deploys run without another release. All three cases pass against an installed app.

Looking for feedback on whether integration test files like these belong in the sample repos alongside the existing unit tests (test_main.py), and whether the placeholder host ID is acceptable or the valid case should be left out.

The README now has a Testing section that explains how to run both the existing unit tests (pytest from a repo-root virtual environment) and these integration tests.

Two test cases for the hello handler covering the happy path (valid name, expects 200 + greeting) and the error case (missing name, expects 400 + error message). These are integration tests for the new foundry functions test command (CLI 2.1.0+), which runs them against the deployed function.
@mraible
mraible requested a review from a team September 16, 2026 21:11
Three test cases: valid host ID (placeholder, replace with a real AID), missing host_id (400), and invalid host ID (404). Shows how to test a function that calls the FalconPy Hosts API.
The Hosts API rejects a malformed device ID with a 400, not a 404.
@mraible mraible changed the title Add integration tests.yml for hello function Add integration tests.yml for hello and host-details functions Oct 7, 2026
@mraible
mraible marked this pull request as ready for review October 7, 2026 00:03
Adds a Testing section covering pytest from a repo-root virtual environment and foundry functions test, including the host ID and one-time install that the host-details tests need.
@mraible
mraible merged commit e8508d0 into main Oct 14, 2026
18 checks passed
@mraible
mraible deleted the add-hello-tests-yml branch October 14, 2026 03:36
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.

2 participants