Skip to content

Conversation

@mithileshgupta12
Copy link
Contributor

@mithileshgupta12 mithileshgupta12 commented Oct 30, 2025

No description provided.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 30, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels Oct 30, 2025
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 30, 2025

I don't think it needs AI to write redundant code to test a well-tested framework function ModifyColumn.

v322 only calls ModifyColumn clearly.

@mithileshgupta12
Copy link
Contributor Author

mithileshgupta12 commented Oct 30, 2025

@wxiaoguang I did not write this with AI. I was just looking at the migrations and saw that we have test for v321 which is using ModifyColumn as well. So wrote similar for v322. But fair enough

@wxiaoguang
Copy link
Contributor

Thank you for the PR, it just reads like some similar PRs I have read 🤣

Could you elaborate why you started the PR? Since I don't think it's necessary to test a framework function. For example: we don't test the file content after we call os.WriteFile, we just assume the framework should work as expected.

@mithileshgupta12
Copy link
Contributor Author

I agree with your point about not testing framework functions. But v321_test.go exists and also tests ModifyColumn. I was just following same pattern for consistency. Should we remove v321_test.go or is there a reason it needs testing that
doesn't apply to v322?

@wxiaoguang
Copy link
Contributor

Maybe some people just copied&pasted code at that time .... and actually v321_test is not quite right: it incorrectly used LONGTEXT for the Notice.Description, so that case asserts nothing ....

Anyway, I am neutral for such tests. So either is fine to me.

@wxiaoguang
Copy link
Contributor

v321 exists due to another reason:

This PR upgrade xorm to v1.3.10 which fixed a bug when both longtext json tags in the struct field. The longtext will be ignored and json will be considered as text

So its test makes sure "LONGTEXT JSON" works.

@mithileshgupta12
Copy link
Contributor Author

Thanks for the explanation @wxiaoguang. Should I close this pr as we don't need to test framework functions. Learned a lot in the process though.

@wxiaoguang
Copy link
Contributor

Or I think we can keep it, and by the way fix the bug in v321_test ?

Actually I found a new bug: the v323 should be in v1_26 package because it (#32751) doesn't belong to 1.25

I can also help if there is anything unclear.

@mithileshgupta12
Copy link
Contributor Author

Yes I will fix the issues. Can you please explain what needs to be fixed in v321_test. You mentioned it
incorrectly uses LONGTEXT for Notice.Description - should I update the
test to properly verify the LONGTEXT JSON behavior?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 30, 2025

v321_test: the Notice struct needs to have a "Description TEXT" field, but not a "LONGTEXT" field. Because the task is to convert the TEXT to LONGTEXT.


should I update the test to properly verify the LONGTEXT JSON behavior?

No to the Notice. The TEXT JSON only belongs to another struct.

@mithileshgupta12
Copy link
Contributor Author

Got it. Will push the fix shortly

@mithileshgupta12
Copy link
Contributor Author

@wxiaoguang pushed the fix for v321_test.go

@wxiaoguang wxiaoguang changed the title Add test for ExtendCommentTreePathLength migration Add test for ExtendCommentTreePathLength migration and fix bugs Oct 30, 2025
@wxiaoguang
Copy link
Contributor

Thank you very much. I will make some more changes to address "Actually I found a new bug: the v323 should be in v1_26 package"

@wxiaoguang
Copy link
Contributor

Made some more changes:

  1. Move 323 to the correct package
  2. Avoid using for-loop to check tables (if there is any typo in table name, the for-loop asserts nothing)

@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 Oct 30, 2025
@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 Oct 30, 2025
@wxiaoguang wxiaoguang merged commit ef90bef into go-gitea:main Oct 31, 2025
26 checks passed
@lunny lunny added this to the 1.26.0 milestone Oct 31, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull request Nov 3, 2025
* giteaofficial/main:
  Add cache to container build (go-gitea#35697)
  Revert gomail to v0.7.0 to fix sending mail failed (go-gitea#35816)
  Fix circular spin animation direction (go-gitea#35785)
  Fix clone mixed bug (go-gitea#35810)
  [skip ci] Updated translations via Crowdin
  Remove unnecessary function parameter (go-gitea#35765)
  Fix cli "Before" handling (go-gitea#35797)
  Add test for ExtendCommentTreePathLength migration and fix bugs (go-gitea#35791)
  Fix file extension on gogs.png (go-gitea#35793)
  Improve and fix markup code preview rendering (go-gitea#35777)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/migrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants