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

Add cache test for admins #31265

Merged
merged 14 commits into from
Jun 17, 2024
Merged

Conversation

6543
Copy link
Member

@6543 6543 commented Jun 5, 2024

Add a test to probe the cache similar to the email test func.

image

image

image

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 5, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 5, 2024
@6543 6543 added type/enhancement An improvement of existing functionality and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 5, 2024
@github-actions github-actions bot added modifies/translation modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files labels Jun 5, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 5, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 5, 2024
@wxiaoguang
Copy link
Contributor

It has been tested during startup.

image

@6543
Copy link
Member Author

6543 commented Jun 5, 2024

yes but esp if it,s a remote dep, it cold break afterwards and this is an easy way to test it

@wxiaoguang
Copy link
Contributor

yes but esp if it,s a remote dep, it cold break afterwards and this is an easy way to test it

If it breaks, either there will be 500 error / error log, or Gitea won't restart. I do not think it needs to "test it" manually on the admin panel, we shouldn't test everything manually there IMO.

If it should be tested, what is the real "use case" for it?

@6543
Copy link
Member Author

6543 commented Jun 6, 2024

The "real" usecase is, as mentoined, to let gitea admins check if the cache works and if it is slow or not ...

As gitea admins do not always have sys acces to logs etc... and if you have it in prod mode the 500 page will tell you nothing! (As it should)

@wxiaoguang
Copy link
Contributor

The "real" usecase is, as mentoined, to let gitea admins check if the cache works and if it is slow or not ...

  • "if the cache works": it won't work in this case. Now Gitea heavily depends on the cache, I can imagine that in the futrue, if the cache doesn't work, then admin couldn't login or couldn't open your "check" page.
  • "if it is slow or not": we have a "self check" page now. I think we should add various checks there, check all of them automatically, instead of adding more "check" buttons.

@wxiaoguang
Copy link
Contributor

and if you have it in prod mode the 500 page will tell you nothing! (As it should)

That's not true because it always shows the detail error messages if you are an admin. And if there is really something wrong, admin should check the logs.

@6543
Copy link
Member Author

6543 commented Jun 6, 2024

sorry but I personally see it as quality of life improvement for admins, if you don't need it it's fine but don't expect all others to have the same view

@silverwind
Copy link
Member

Personally I don't mind such troubleshooting buttons. They are good to have when the need arises.

@wxiaoguang
Copy link
Contributor

Personally I don't mind such troubleshooting buttons. They are good to have when the need arises.

Why not just re-use the "self check" page? Test everything automatically.

@silverwind
Copy link
Member

image

Maybe something can be done about the vertical centering of text and button in this list, I can check it out later.

@silverwind
Copy link
Member

Personally I don't mind such troubleshooting buttons. They are good to have when the need arises.

Why not just re-use the "self check" page? Test everything automatically.

Hmm, if self-check includes this check, then we should at least make self check call this function instead of having two duplicate check functions.

options/locale/locale_en-US.ini Outdated Show resolved Hide resolved
@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 Jun 6, 2024
@techknowlogick
Copy link
Member

Fwiw, I don't see this as any different from the testing mail functionality, as not all code paths will fail if cache is unavailable (unlike if DB fails), and so adding the option for an admin to check would be good.

I'll wait to review until the duplication reduction mentioned by @silverwind is handled.

@6543
Copy link
Member Author

6543 commented Jun 11, 2024

I can take a look at that centering later.

thanks!!! I tryed to vertically center it but I could not get it to work :/

@6543 6543 requested a review from techknowlogick June 11, 2024 13:27
@6543
Copy link
Member Author

6543 commented Jun 11, 2024

@techknowlogick add the check to the serftest too ... and mv it into a dedicated func with an unit test

@silverwind
Copy link
Member

silverwind commented Jun 11, 2024

Noticed one UI problem: If there is a error displayed on the Summary page, the test result message will not show because the error message apparently has precedence:

image

Either make both show or use showInfoToast and showErrorToast in JS to display the result as toast. Toast is imho better because it does not need a page reload.

To reproduce, add this to app.ini:

[log]
ROUTER = foo

@silverwind
Copy link
Member

Regarding centering, I think it's actually better not to do it because it would cause this labels on other content to move like this:

image

@silverwind
Copy link
Member

Actually I decided to center those two entries with the test functions with some tailwind, this is how it looks now:

image

@6543
Copy link
Member Author

6543 commented Jun 11, 2024

Noticed one UI problem: If there is a error displayed on the Summary page, the test result message will not show because the error message apparently has precedence:
image

...

is this not out of scope of this pull 😆

@silverwind
Copy link
Member

silverwind commented Jun 11, 2024

Noticed one UI problem: If there is a error displayed on the Summary page, the test result message will not show because the error message apparently has precedence:
image
...

is this not out of scope of this pull 😆

If it affects test email too, I'd say out of scope. I assume the bug is in backend flash somewhere. At least the template code has the ability to render one flash per severity level. Imho it needs a ability to render more than one flash per severity but that is definitly out of scope 😆.

@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 Jun 11, 2024
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jun 11, 2024

Noticed one UI problem: If there is a error displayed on the Summary page, the test result message will not show because the error message apparently has precedence:
image
...

is this not out of scope of this pull 😆

If it affects test email too, I'd say out of scope. I assume the bug is in backend flash somewhere. At least the template code has the ability to render one flash per severity level. Imho it needs a ability to render more than one flash per severity but that is definitly out of scope 😆.

That's why it should use "self check" page to test it automaticaly, instead of adding more "check" buttons (no more flash)

@silverwind silverwind self-requested a review June 11, 2024 23:40
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Jun 11, 2024
@silverwind
Copy link
Member

silverwind commented Jun 11, 2024

It's still not part of /admin/self_check? I was under the impression it was. I don't mind having the button to trigger it individually but if it is part of the self check, it's certainly kind of redundant.

@6543
Copy link
Member Author

6543 commented Jun 12, 2024

well it is indeed usefull to have it in the selve test but I realy want to have the manuall feedback for this specific part of gitea for admins ... and as we now just use the same func there is no much dublicated code at all

@wxiaoguang
Copy link
Contributor

It's still not part of /admin/self_check? I was under the impression it was. I don't mind having the button to trigger it individually but if it is part of the self check, it's certainly kind of redundant.

I didn't mean block, I could refactor&improve the self-check page later.

Copy link
Member

@silverwind silverwind left a comment

Choose a reason for hiding this comment

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

Well, let's take it then, to be hopefully improved later.

@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 Jun 17, 2024
@silverwind silverwind merged commit 363c123 into go-gitea:main Jun 17, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Jun 17, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 18, 2024
* giteaofficial/main:
  Fix rendered wiki page link (go-gitea#31398)
  Refactor repo unit "disabled" check (go-gitea#31389)
  Refactor route path normalization (go-gitea#31381)
  Refactor markup code (go-gitea#31399)
  Add cache test for admins (go-gitea#31265)
  Fix double border in system status table (go-gitea#31363)
  Improve rubygems package registry (go-gitea#31357)
  Fix natural sort (go-gitea#31384)
  Fix missing images in editor preview due to wrong links (go-gitea#31299)
  Add a simple test for AdoptRepository (go-gitea#31391)
  [skip ci] Updated licenses and gitignores
@6543 6543 deleted the add-cache-test-for-admins branch June 18, 2024 12:44
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/templates This PR modifies the template files modifies/translation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants