Skip to content

Commit

Permalink
Kd/fix redis unit test (go-gitea#24650)
Browse files Browse the repository at this point in the history
Replaces go-gitea#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
  • Loading branch information
kdumontnu authored May 11, 2023
1 parent 36ed6bd commit a54c8b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/pull-db_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ jobs:
- "143:143"
- "587:587"
- "993:993"
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
ports:
- 6379:6379
steps:
- name: checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion modules/queue/base_redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") == "" {
t.Skip("redis-server not found")
return
}
Expand Down

0 comments on commit a54c8b4

Please sign in to comment.