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 phase/extender_test.go #1297

Merged

Conversation

phil9909
Copy link
Contributor

Summary

Refactor phase/extender_test.go as suggested in #1276 (comment)

Context

In #1276 we duplicated most of the test code in phase/extender_test.go, basically doing the same tests twice, once for Platform API 0.12 and once for 0.13. The API versions expect a different folder layout, which requires changes to the test setup. The reduce the size of phase/extender_test.go, I:

  • moved the code to create the folder layout into a helper function (it will check for the Platform API version and behave differently based on that)
  • added a loop around the test cases looping over API versions.

Now we have every tests only once in code, while still being executed twice.

The drawback: The helper function is quite complex (especially for test code).

A middle ground could be to keep the loop, but to the Platform API version switch in every test case.

@natalieparellano WDYT?

Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
@phil9909 phil9909 requested a review from a team as a code owner February 16, 2024 09:43
Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

@phil9909 thanks a lot for this! Despite the complexity of prepareDockerfile I think this will make our lives a lot easier. I added a comment suggestion to hopefully make it friendlier for newcomers.

Co-authored-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Philipp Stehle <philipp.stehle@sap.com>
@phil9909
Copy link
Contributor Author

phil9909 commented Feb 19, 2024

Added your suggestions. Thanks for the quick review.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.57%. Comparing base (92bb4fb) to head (840b035).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1297      +/-   ##
==========================================
- Coverage   64.65%   64.57%   -0.08%     
==========================================
  Files         101      101              
  Lines        6949     6984      +35     
==========================================
+ Hits         4492     4509      +17     
- Misses       2051     2064      +13     
- Partials      406      411       +5     
Flag Coverage Δ
os_linux 64.04% <ø> (-0.07%) ⬇️
os_windows 56.61% <ø> (-0.29%) ⬇️
unit 64.04% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@natalieparellano natalieparellano merged commit 553c041 into buildpacks:main Feb 28, 2024
10 checks passed
@modulo11 modulo11 deleted the refactor-extender-test branch February 29, 2024 07:56
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