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

Fix commit_status problem when testing #29672

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

charles7668
Copy link
Contributor

@charles7668 charles7668 commented Mar 8, 2024

Close #29661

fix #29656

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 8, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 8, 2024
@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 Mar 8, 2024
@lunny
Copy link
Member

lunny commented Mar 8, 2024

I want to know why the CI PASS when tests in PR. https://github.com/go-gitea/gitea/actions/runs/8198780164/job/22422906368

@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 Mar 8, 2024
@lunny lunny added type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels Mar 8, 2024
@lunny lunny enabled auto-merge (squash) March 8, 2024 14:39
@6543 6543 changed the title Fix commit_status problem when testing. (#29661) Fix commit_status problem when testing Mar 8, 2024
@lunny lunny disabled auto-merge March 8, 2024 14:43
@charles7668
Copy link
Contributor Author

I want to know why the CI PASS when tests in PR.

The problem is related to the behavior of the for range loop with map structures in Go. The order of iteration is not the same every time, so not every test will fail.

@6543 6543 added the backport/v1.21 This PR should be backported to Gitea 1.21 label Mar 8, 2024
@silverwind
Copy link
Member

I want to know why the CI PASS when tests in PR.

The problem is related to the behavior of the for range loop with map structures in Go. The order of iteration is not the same every time, so not every test will fail.

The code itself does not depend on order, right? If it does we may need something like https://github.com/iancoleman/orderedmap.

@yp05327
Copy link
Contributor

yp05327 commented Mar 8, 2024

Maybe the test cases can be merged together, instead of using the index?
e.g.

testCases := []struct{
  commitStatus []*git_model.CommitStatus
  required []string
  expected structs.CommitStatusState
}

@silverwind silverwind enabled auto-merge (squash) March 8, 2024 15:17
@silverwind silverwind disabled auto-merge March 8, 2024 15:17
@silverwind silverwind removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 8, 2024
@charles7668
Copy link
Contributor Author

I want to know why the CI PASS when tests in PR.

The problem is related to the behavior of the for range loop with map structures in Go. The order of iteration is not the same every time, so not every test will fail.

The code itself does not depend on order, right? If it does we may need something like https://github.com/iancoleman/orderedmap.

Yes , it doesn't depend .

@charles7668
Copy link
Contributor Author

Maybe the test cases can be merged together, instead of using the index? e.g.

testCases := []struct{
  commitStatus []*git_model.CommitStatus
  required []string
  expected structs.CommitStatusState
}

This sounds like a great change. However, should I make this change in this PR? It seems like an unrelated change.

@silverwind
Copy link
Member

I agree, let's do that in another PR.

@silverwind silverwind merged commit 0c273f1 into go-gitea:main Mar 8, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Mar 8, 2024
GiteaBot added a commit to GiteaBot/gitea that referenced this pull request Mar 8, 2024
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Mar 8, 2024
6543 pushed a commit that referenced this pull request Mar 8, 2024
Backport #29672 by @charles7668

Close #29661

fix #29656

Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 8, 2024
* giteaofficial/main:
  Fix commit_status problem when testing (go-gitea#29672)
  Support pasting URLs over markdown text (go-gitea#29566)
  bump python version to 3.12 in dev container (go-gitea#29670)
@denyskon denyskon modified the milestones: 1.23.0, 1.22.0 Mar 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
@charles7668 charles7668 deleted the fix_commit_status branch April 10, 2024 01:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created backport/v1.21 This PR should be backported to Gitea 1.21 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test TestMergeRequiredContextsCommitStatus
7 participants