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

test: refactor/simplify container mock builders #1495

Merged
merged 1 commit into from
Dec 6, 2022
Merged

Conversation

piksel
Copy link
Member

@piksel piksel commented Dec 6, 2022

This PR replaces the mockContainerWith* helpers with a compositable MockContainer function that takes an arbitrary number of updates that mutate the mocked container.
This makes it much easier to combine those parts of the container state that needs to be mocked instead of creating new specialized helpers.

Example usage:

mockContainer := MockContainer(
	WithImageName("docker.io/prefix/imagename:latest"),
	WithLabels(map[string]string{ "com.centurylinklabs.watchtower.enable": "true" }),
	WithPortBindings("80/tcp"),
)

@piksel piksel requested a review from simskij as a code owner December 6, 2022 15:23
@codecov
Copy link

codecov bot commented Dec 6, 2022

Codecov Report

Base: 64.76% // Head: 64.76% // No change to project coverage 👍

Coverage data is based on head (e3543ce) compared to base (d5d711b).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1495   +/-   ##
=======================================
  Coverage   64.76%   64.76%           
=======================================
  Files          24       24           
  Lines        2310     2310           
=======================================
  Hits         1496     1496           
  Misses        718      718           
  Partials       96       96           

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.

@piksel piksel merged commit a4d00bf into main Dec 6, 2022
@piksel piksel deleted the test/container-mock branch December 6, 2022 15:28
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.

1 participant