Maintenance: e2e test invocation always forces cold starts #590
Labels
completed
This item is complete and has been merged/shipped
good-first-issue
Something that is suitable for those who want to start contributing
internal
PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
logger
This item relates to the Logger Utility
tests
PRs that add or change tests
Milestone
Bug description
The current implementation of the helper function that invokes functions deployed as part of the e2e test of the logger calls the functions in parallel. This has the potentially unintended effect of always forcing cold starts in the functions. This happens because the Lambda service receives two concurrent invocation requests and as such it has to spin up two execution environments to handle them.
Some of the test cases, like this one, that intend to assert that the correct cold start value is included in the log entries are affected as result and can never pass.
Expected Behavior
Test case to pass if tested code is correct.
Current Behavior
Test case always fails.
Possible Solution
Two possible solutions:
Option A
Change the helper function to always invoke functions in sequence rather than in parallel, like so (this implementation makes the test pass with the changes in #550):
Option B
Change the helper function to accept a third param
parallel
(defaults totrue
) and let the caller decide (pseudo-code example):The benefit of this second option is that since most test cases don't care about the mode of invocation they could have slightly faster execution time (since they'd be invoked in parallel).
The downside of this option is that there's now additional cognitive load for maintainers since this introduces two branches in the code and in case of failure we'd have to first check which mode was used.
Steps to Reproduce
e2eUtils.ts
file for the functions part of the testEnvironment
Related issues, RFCs
#550
The text was updated successfully, but these errors were encountered: