aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle D <kdumontnu@gmail.com>2023-05-10 22:09:37 -0400
committerGitHub <noreply@github.com>2023-05-11 10:09:37 +0800
commita54c8b4ce900caee7b41b813c7c728e57618fd95 (patch)
tree541063a118296ddffcd8dbd663238fe847597131
parent36ed6bdd0cbb14f4e67242bcd3c06a3612dd0fb9 (diff)
downloadgitea-a54c8b4ce900caee7b41b813c7c728e57618fd95.tar.gz
gitea-a54c8b4ce900caee7b41b813c7c728e57618fd95.zip
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
-rw-r--r--.github/workflows/pull-db_test.yml10
-rw-r--r--modules/queue/base_redis_test.go2
2 files changed, 11 insertions, 1 deletions
diff --git a/.github/workflows/pull-db_test.yml b/.github/workflows/pull-db_test.yml
index ce97bfcb2c..243499b611 100644
--- a/.github/workflows/pull-db_test.yml
+++ b/.github/workflows/pull-db_test.yml
@@ -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
diff --git a/modules/queue/base_redis_test.go b/modules/queue/base_redis_test.go
index 3d49e8d98c..19fbccbc8f 100644
--- a/modules/queue/base_redis_test.go
+++ b/modules/queue/base_redis_test.go
@@ -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
}