Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to trigger errors in mock http mode #5

Merged
merged 2 commits into from
May 14, 2019

Conversation

kconwayatlassian
Copy link
Contributor

Add ability to document errors returned by any function.
Add special headers to trigger errors while in mock mode.

Note that only HTTP mode is supported as there is no mechanism for
conveying a trigger through vanilla lambda. If we were to build a real
or mock version of the lambda binary then the only way to interact with
it is through the real lambda API or through the real AWS API Gateway.
Neither of these enable us to add a trigger within a function or within
a function decorator because they do not convey the state that we need
without modifying the request body. As a result, this only works for
HTTP mode but can still be used to test serverfull-gateway templates.

@kconwayatlassian kconwayatlassian requested a review from a team as a code owner May 10, 2019 18:30
@codecov
Copy link

codecov bot commented May 10, 2019

Codecov Report

Merging #5 into master will increase coverage by 1.09%.
The diff coverage is 96.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #5      +/-   ##
==========================================
+ Coverage    91.3%   92.39%   +1.09%     
==========================================
  Files           9        9              
  Lines         207      263      +56     
==========================================
+ Hits          189      243      +54     
- Misses         12       13       +1     
- Partials        6        7       +1
Impacted Files Coverage Δ
domain.go 100% <ø> (ø) ⬆️
mfunction.go 100% <100%> (ø) ⬆️
function.go 100% <100%> (ø) ⬆️
invokeapi.go 96.19% <100%> (+1.38%) ⬆️
router.go 100% <100%> (ø) ⬆️
start.go 83.78% <88.88%> (+1.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1df46d5...b09b931. Read the comment docs.

zlozano
zlozano previously approved these changes May 13, 2019
@kconwayatlassian kconwayatlassian requested a review from a team May 13, 2019 19:31
bkrebsbach
bkrebsbach previously approved these changes May 13, 2019
Add ability to document errors returned by any function.
Add special headers to trigger errors while in mock mode.

Note that only HTTP mode is supported as there is no mechanism for
conveying a trigger through vanilla lambda. If we were to build a real
or mock version of the lambda binary then the only way to interact with
it is through the real lambda API or through the real AWS API Gateway.
Neither of these enable us to add a trigger within a function or within
a function decorator because they do not convey the state that we need
without modifying the request body. As a result, this only works for
HTTP mode but can still be used to test serverfull-gateway templates.
This prevent the tests from failing on a system that has port 9090 in
use by selecting a port that is known to be available.
@kconwayatlassian
Copy link
Contributor Author

I had to rebase after merging log/stat injection. I also added a commit that adds dynamic port selection for the integration tests so we don't rely on a single "magic" port number.

@kconwayatlassian kconwayatlassian requested a review from a team May 14, 2019 13:39
@kconwayatlassian kconwayatlassian merged commit c9f5f13 into master May 14, 2019
@kconwayatlassian kconwayatlassian deleted the mock-errors branch May 14, 2019 20:39
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.

None yet

3 participants