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: stop using mpatch #1654

Merged
merged 2 commits into from
Dec 11, 2021
Merged

Conversation

alexmt
Copy link
Contributor

@alexmt alexmt commented Nov 12, 2021

Signed-off-by: Alexander Matyushentsev [email protected]

Unit tests are failing on mac :( Looks like https://github.com/undefinedlabs/go-mpatch does not work well on the latest mac os versions. There is no ARM support as well: undefinedlabs/go-mpatch#2 . The ARM support was requested in 2020, so unlikely it will be supported.

I suggest to stop using https://github.com/undefinedlabs/go-mpatch. PR removes the usage in one place. We still use the library in controller_test.go#newFixture

@codecov
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #1654 (3d6da0d) into master (4d3b992) will decrease coverage by 0.01%.
The diff coverage is 88.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1654      +/-   ##
==========================================
- Coverage   82.07%   82.05%   -0.02%     
==========================================
  Files         116      116              
  Lines       16064    16064              
==========================================
- Hits        13184    13181       -3     
- Misses       2208     2210       +2     
- Partials      672      673       +1     
Impacted Files Coverage Δ
pkg/kubectl-argo-rollouts/cmd/restart/restart.go 90.00% <0.00%> (ø)
utils/conditions/conditions.go 80.76% <33.33%> (ø)
metricproviders/cloudwatch/cloudwatch.go 72.47% <66.66%> (ø)
metricproviders/datadog/datadog.go 77.62% <66.66%> (ø)
analysis/analysis.go 85.74% <75.00%> (ø)
analysis/controller.go 52.17% <100.00%> (ø)
experiments/controller.go 67.28% <100.00%> (ø)
experiments/experiment.go 89.64% <100.00%> (ø)
experiments/replicaset.go 84.97% <100.00%> (ø)
metricproviders/graphite/graphite.go 100.00% <100.00%> (ø)
... and 19 more

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 4d3b992...3d6da0d. Read the comment docs.

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

You removed one instance, but there are 3 others so we haven't removed the dependency completely since the go.mod/go.sum haven't been affected.

I think you either have to modify the other tests to remove it or:

If you are emboldened, we could switch our code to use a util/time.Now() helper which is can be overwritten by unit tests

@alexmt alexmt force-pushed the no-mpatch-in-list-test branch from c921b34 to ac80a74 Compare December 1, 2021 00:53
@alexmt alexmt changed the title refactor: stop using mpatch in TestListNamespaceAndTimestamp test refactor: stop using mpatch Dec 1, 2021
@alexmt
Copy link
Contributor Author

alexmt commented Dec 1, 2021

Good suggestion @jessesuen .

I've introduced util/time package and using it instead of time.Now/metav1.Now. I was planning to make minimal possible changes. It appears that I had to change a lot to make tests pass. The PR is big but all changes just additional import and switch to timeutil.Now/timeutil.MetaNow function.

PTAL

@alexmt alexmt force-pushed the no-mpatch-in-list-test branch from ac80a74 to 3d6da0d Compare December 3, 2021 18:51
@sonarcloud
Copy link

sonarcloud bot commented Dec 3, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
6.0% 6.0% Duplication

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