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

Refactor how node binary is retrieved for functions/extensions. #5422

Merged
merged 14 commits into from
Jan 19, 2023

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Jan 13, 2023

Today, Functions Emulator make strong assumption that all functions target node runtime and pass around references like nodeBinary, nodeMajorVersion, etc.

This PR refactors the logic to abstract away node into bin and runtime. The logic for choosing the appropriate bin for the function is lifted to RuntimeDelegate, same piece of code that holds together other nodejs runtime specific logic.

The refactored required small changes to the extensions emulator - looping in @joehan to see if he has any objections.

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2023

Codecov Report

Base: 56.34% // Head: 56.30% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (e7d25e2) compared to base (9be77ff).
Patch coverage: 13.84% of modified lines in pull request are covered.

Additional details and impacted files
@@                      Coverage Diff                       @@
##           Remove_go_discovery_module    #5422      +/-   ##
==============================================================
- Coverage                       56.34%   56.30%   -0.04%     
==============================================================
  Files                             313      313              
  Lines                           21198    21208      +10     
  Branches                         4325     4327       +2     
==============================================================
- Hits                            11943    11942       -1     
- Misses                           8218     8228      +10     
- Partials                         1037     1038       +1     
Impacted Files Coverage Δ
src/deploy/functions/runtimes/index.ts 54.16% <ø> (ø)
src/emulator/controller.ts 12.70% <0.00%> (-0.24%) ⬇️
src/emulator/extensionsEmulator.ts 35.25% <ø> (ø)
src/emulator/functionsEmulator.ts 7.27% <3.84%> (+0.33%) ⬆️
src/deploy/functions/runtimes/node/index.ts 19.14% <4.34%> (-5.51%) ⬇️
src/extensions/emulator/specHelper.ts 46.15% <46.15%> (-3.85%) ⬇️
src/extensions/emulator/optionsHelper.ts 42.47% <50.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@taeold taeold requested a review from joehan January 17, 2023 23:04
@taeold taeold marked this pull request as ready for review January 17, 2023 23:05
@TheIronDev
Copy link
Contributor

Can you write tests for these new functions too?

Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

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

This change makes a lot of sense to me and mostly looks good. However, I get a little worried whenever we start messing with paths in the emulator.

Could you test the following cases:

  • Emulate an extension, confirm it executes
  • Emulate an extension, confirm it uses the right version of node (even when different from the system version)

src/emulator/extensionsEmulator.ts Show resolved Hide resolved
@taeold
Copy link
Contributor Author

taeold commented Jan 18, 2023

@joehan

Could you test the following cases:
Emulate an extension, confirm it executes

Doesn't the extensions emulator test exercise this scenario? Was hoping that it did!

@joehan
Copy link
Contributor

joehan commented Jan 18, 2023

@taeold Totally forgot we had that test running on CI - it definitely does cover that case

@taeold taeold changed the base branch from Remove_go_discovery_module to master January 19, 2023 19:07
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

4 participants