Skip to content

Skip redis test if redis-server not available #24641

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

Closed
wants to merge 3 commits into from

Conversation

zeripath
Copy link
Contributor

If the redis-server command is not available then we should just skip the test.

If the `redis-server` command is not available then we should just skip the test.
@zeripath zeripath added this to the 1.20.0 milestone May 10, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 10, 2023
@@ -56,7 +56,7 @@ func TestBaseRedis(t *testing.T) {
}()
if !waitRedisReady("redis://127.0.0.1:6379/0", 0) {
redisServer = redisServerCmd(t)
if redisServer == nil && os.Getenv("CI") != "" {
if redisServer == nil || os.Getenv("CI") != "" {
Copy link
Contributor

@wxiaoguang wxiaoguang May 10, 2023

Choose a reason for hiding this comment

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

I would suggest not doing so.

Keep the old logic will remind developers that "please remember to test the redis queue"

Since in most cases, developers only run single test, this test doesn't affect them.

And there is always a chance for developers to bypass it: CI=local make test-xxxx


I think it's better to clarify the failure message: please use "CI=local make test" if you want to run the full test but do not have a redis-server

But if most people prefer to skip the redis queue test, I have no objection.

Copy link
Contributor

@kdumontnu kdumontnu May 10, 2023

Choose a reason for hiding this comment

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

Maybe I'm mis-understanding the use of the CI env variable. The problem with the existing logic on main is that it will skip the test with CI=1 (or anything else).

The problem with the logic suggested here is that it will just always skip the test :)

Please see my suggestion below. I think the default should be local (CI='') and we set the CI env flag in CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not reasonable to force developers to install redis in order to run tests.

Co-authored-by: Kyle D. <kdumontnu@gmail.com>
Copy link
Contributor

@kdumontnu kdumontnu left a comment

Choose a reason for hiding this comment

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

👍

@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 May 10, 2023
@kdumontnu
Copy link
Contributor

kdumontnu commented May 10, 2023

Hmm, looks like builds are failing now because we don't have minio set up for unit tests.

We can add minio redis as a service for the unit tests:

@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 May 10, 2023
Copy link
Contributor

@kdumontnu kdumontnu left a comment

Choose a reason for hiding this comment

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

Rejecting until we add redis service in unit test

(also testing GiteaBot 😄)

Competing PR: #24650

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels May 10, 2023
lunny pushed a commit that referenced this pull request May 11, 2023
Replaces #24641

Currently, unit tests fail when run locally (unless users have minio
instance running). This PR only requires redis unit tests if in CI.

- Only run redis unit tests when `CI` env variable is set
- Add minio as a service in unit tests actions
@lunny
Copy link
Member

lunny commented May 11, 2023

replaced by #24650

@lunny lunny closed this May 11, 2023
@GiteaBot GiteaBot removed this from the 1.20.0 milestone May 11, 2023
@zeripath zeripath deleted the skip-redis-test branch May 11, 2023 10:03
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged type/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants