Skip to content

Commit

Permalink
ci: update Go version and improve Redis test setup (#24)
Browse files Browse the repository at this point in the history
* ci: update Go version and improve Redis test setup

- Remove Go 1.21 from the GitHub Actions workflow
- Remove environment variables and Redis setup steps from GitHub Actions workflow
- Update Go version to 1.22 in go.mod
- Add testcontainers-go and other dependencies to go.mod
- Add setup functions for Redis and Redis Cluster containers in tests
- Replace hardcoded Redis host with dynamic endpoint in tests
- Enable and update the TestRedisCluster test
- Add context and container cleanup to various tests

Signed-off-by: appleboy <[email protected]>

* refactor: improve test reliability and API usage in RedisCluster tests

- Replace `t.Helper()` with `t.Skip()` in `TestRedisCluster` function

Signed-off-by: appleboy <[email protected]>

---------

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy authored Jan 19, 2025
1 parent 2f62c01 commit 898b07c
Show file tree
Hide file tree
Showing 4 changed files with 334 additions and 33 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
go: [1.21, 1.22, 1.23]
go: [1.22, 1.23]
include:
- os: ubuntu-latest
go-build: ~/.cache/go-build
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org

steps:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 6

# Running Test
- name: Running Test
run: |
sudo apt-get install -y redis-tools
docker ps -a
redis-cli -h 127.0.0.1 -p 6379 ping
redis-cli -h 127.0.0.1 -p 6379 cluster nodes
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
Expand Down
46 changes: 45 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,64 @@
module github.com/golang-queue/redisdb-stream

go 1.21
go 1.22

require (
github.com/appleboy/com v0.2.1
github.com/golang-queue/queue v0.1.4-0.20221230133718-0314ef173f98
github.com/redis/go-redis/v9 v9.7.0
github.com/stretchr/testify v1.10.0
github.com/testcontainers/testcontainers-go v0.35.0
go.uber.org/goleak v1.3.0
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/containerd v1.7.18 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v27.1.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/shirou/gopsutil/v3 v3.23.12 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/sys v0.28.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 898b07c

Please sign in to comment.