Test against Redis CE (#3191)

* Create workflow that tests go-redis against docker

* Add docker compose file

* Add docker compose file

* Change command in docker compose

* Load modules locally

* test varios redis versions

* add env var to test-redis-enterprise action

* cleaning code

* cleaning code
This commit is contained in:
ofekshenawa 2024-12-16 19:04:39 +02:00 committed by GitHub
parent caa2592db7
commit 91dddc2e11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 69 additions and 3 deletions

View File

@ -43,3 +43,46 @@ jobs:
with: with:
files: coverage.txt files: coverage.txt
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
test-redis-ce:
name: test-redis-ce
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
redis_version:
- "8.0-M01"
- "7.4.1"
- "7.2.6"
- "6.2.16"
go-version:
- "1.19.x"
- "1.20.x"
- "1.21.x"
steps:
- name: Set up ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
# Set up Docker Compose environment
- name: Set up Docker Compose environment
run: |
docker compose --profile all up -d
- name: Run tests
env:
USE_CONTAINERIZED_REDIS: "true"
RE_CLUSTER: "true"
run: |
go test \
--ginkgo.skip-file="ring_test.go" \
--ginkgo.skip-file="sentinel_test.go" \
--ginkgo.skip-file="osscluster_test.go" \
--ginkgo.skip-file="pubsub_test.go" \
--ginkgo.skip-file="gears_commands_test.go" \
--ginkgo.label-filter='!NonRedisEnterprise'

View File

@ -47,6 +47,7 @@ jobs:
- name: Test - name: Test
env: env:
RE_CLUSTER: "1" RE_CLUSTER: "1"
USE_CONTAINERIZED_REDIS: "1"
run: | run: |
go test \ go test \
--ginkgo.skip-file="ring_test.go" \ --ginkgo.skip-file="ring_test.go" \

21
docker-compose.yml Normal file
View File

@ -0,0 +1,21 @@
---
services:
redis-stanalone:
image: redislabs/client-libs-test:8.0-M02
container_name: redis-standalone
environment:
- REDIS_CLUSTER=no
- PORT=6379
- TLS_PORT=6666
command: --loadmodule /usr/local/lib/redis/modules/redisbloom.so --loadmodule /usr/local/lib/redis/modules/redisearch.so --loadmodule /usr/local/lib/redis/modules/redistimeseries.so --loadmodule /usr/local/lib/redis/modules/rejson.so
ports:
- 6379:6379
- 6380:6379
- 6666:6666 # TLS port
volumes:
- "./dockers/redis-standalone:/redis/work"
profiles:
- standalone
- all

View File

@ -66,6 +66,7 @@ var cluster = &clusterScenario{
} }
var RECluster = false var RECluster = false
var USE_CONTAINERIZED_REDIS = false
func registerProcess(port string, p *redisProcess) { func registerProcess(port string, p *redisProcess) {
if processes == nil { if processes == nil {
@ -82,8 +83,8 @@ var _ = BeforeSuite(func() {
} }
var err error var err error
RECluster, _ = strconv.ParseBool(os.Getenv("RE_CLUSTER")) RECluster, _ = strconv.ParseBool(os.Getenv("RE_CLUSTER"))
USE_CONTAINERIZED_REDIS, _ = strconv.ParseBool(os.Getenv("USE_CONTAINERIZED_REDIS"))
if !RECluster { if !RECluster || !USE_CONTAINERIZED_REDIS {
redisMain, err = startRedis(redisPort) redisMain, err = startRedis(redisPort)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())