1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 16:44:26 +00:00

Kd/fix redis unit test (#24650)

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
This commit is contained in:
Kyle D 2023-05-10 22:09:37 -04:00 committed by GitHub
parent 36ed6bdd0c
commit a54c8b4ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -110,6 +110,16 @@ jobs:
- "143:143" - "143:143"
- "587:587" - "587:587"
- "993:993" - "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: steps:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@ -56,7 +56,7 @@ func TestBaseRedis(t *testing.T) {
}() }()
if !waitRedisReady("redis://127.0.0.1:6379/0", 0) { if !waitRedisReady("redis://127.0.0.1:6379/0", 0) {
redisServer = redisServerCmd(t) redisServer = redisServerCmd(t)
if redisServer == nil && os.Getenv("CI") != "" { if redisServer == nil && os.Getenv("CI") == "" {
t.Skip("redis-server not found") t.Skip("redis-server not found")
return return
} }