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

Refactored and fixed migration tests #16714

Merged
merged 2 commits into from
Aug 18, 2021

Conversation

KN4CK3R
Copy link
Member

@KN4CK3R KN4CK3R commented Aug 17, 2021

I've refactored and fixed the migration tests. They now use all the same test methods.
The tests for Gitlab, Gitea and Gogs were broken and are fixed now.
I removed the usage of time.Now() in the downloaders because you can't write normal tests with changing values. Empty timestamps are now populated in the uploader.

Other changes/fixes:

  • GiteaLocalUploader
    • Set Milestone.CreatedUnix/UpdatedUnix
  • GitlabDownloader
    • Use MergeRequestApprovals.GetConfiguration instead of MergeRequestApprovals.GetApprovalState
  • GogsDownloader
    • Set Issue.PosterID and Issue.Updated

@KN4CK3R KN4CK3R added type/refactoring Existing code has been cleaned up. There should be no new functionality. type/testing labels Aug 17, 2021
@KN4CK3R KN4CK3R added this to the 1.16.0 milestone Aug 17, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2021

Codecov Report

Merging #16714 (a4f3690) into main (ea07726) will decrease coverage by 0.01%.
The diff coverage is 18.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16714      +/-   ##
==========================================
- Coverage   45.38%   45.37%   -0.02%     
==========================================
  Files         758      758              
  Lines       85306    85381      +75     
==========================================
+ Hits        38713    38738      +25     
- Misses      40313    40362      +49     
- Partials     6280     6281       +1     
Impacted Files Coverage Δ
modules/migrations/gitea_downloader.go 0.93% <0.00%> (ø)
modules/migrations/gitea_uploader.go 6.77% <0.00%> (-0.63%) ⬇️
modules/migrations/gitlab.go 0.99% <0.00%> (+<0.01%) ⬆️
modules/migrations/gogs.go 2.36% <0.00%> (+0.01%) ⬆️
models/models.go 52.88% <33.33%> (-0.54%) ⬇️
models/token.go 69.04% <77.27%> (+2.38%) ⬆️
modules/setting/setting.go 49.90% <100.00%> (+0.09%) ⬆️
services/auth/source/oauth2/providers_custom.go 63.23% <100.00%> (ø)
services/pull/pull.go 41.78% <0.00%> (ø)
models/gpg_key_common.go 64.51% <0.00%> (+4.83%) ⬆️
... and 1 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 65c6acc...a4f3690. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 17, 2021
Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

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

Could you update the initial comment to explain that you've fixed some other little bugs too?

I see for example you've set the PosterID in Gogs which was previously missing.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 17, 2021
@KN4CK3R
Copy link
Member Author

KN4CK3R commented Aug 17, 2021

Could you update the initial comment to explain that you've fixed some other little bugs too?

I see for example you've set the PosterID in Gogs which was previously missing.

done

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 18, 2021
@techknowlogick techknowlogick merged commit 422c30d into go-gitea:main Aug 18, 2021
@KN4CK3R KN4CK3R deleted the refactor-migration-test branch August 18, 2021 19:51
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality. type/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants