Skip to content

Commit

Permalink
fix redis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed Sep 16, 2023
1 parent f397243 commit f113998
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 46 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ jobs:
- name: Install Azurite
run: |
docker run -d -p 10000:10000 mcr.microsoft.com/azure-storage/azurite azurite-blob --blobHost 0.0.0.0 --blobPort 10000
- name: Install Coherence
run: |
docker run -d -p 1408:1408 -p 30000:30000 ghcr.io/oracle/coherence-ce:22.06.5
sleep 30
- name: Install couchbase
run: |
docker run --name couchbase -d -p 8091-8097:8091-8097 -p 9123:9123 -p 11207:11207 -p 11210:11210 -p 11280:11280 -p 18091-18097:18091-18097 couchbase:enterprise-7.1.1
sleep 10
docker exec --tty couchbase couchbase-cli cluster-init -c localhost:8091 --cluster-username admin --cluster-password 123456 --cluster-ramsize 256 --services data
sleep 10
docker exec --tty couchbase couchbase-cli bucket-create -c localhost:8091 --username admin --password 123456 --bucket fiber_storage --bucket-type couchbase --bucket-ramsize 100 --enable-flush 1
- name: Install etcd
run: |
docker run -d --name Etcd-server \
Expand All @@ -109,17 +112,10 @@ jobs:
--env ALLOW_NONE_AUTHENTICATION=yes \
--env ETCD_ADVERTISE_CLIENT_URLS=http://etcd-server:2379 \
bitnami/etcd:latest
- name: Install MinIO
run: |
docker run -d --restart always -p 9000:9000 --name storage-minio -e MINIO_ROOT_USER='minio-user' -e MINIO_ROOT_PASSWORD='minio-password' minio/minio server /data
- name: Generate TLS certs
run: ./.github/scripts/gen-test-certs.sh

- name: Add Custom CA cert
run: sudo cp /home/runner/work/storage/storage/tls/ca.crt /usr/local/share/ca-certificates/custom.crt

- name: Trust Custom CA Cert
run: sudo update-ca-certificates
- name: Setup Redis
uses: shogo82148/actions-setup-redis@v1
Expand All @@ -129,10 +125,7 @@ jobs:

- name: Run Redis
run: |
redis-server --tls-port 6380 --port 6379 \
--tls-cert-file /home/runner/work/storage/storage/tls/redis.crt \
--tls-key-file /home/runner/work/storage/storage/tls/redis.key \
--tls-ca-cert-file /home/runner/work/storage/storage/tls/ca.crt &
redis-server --port 6379 &
- name: Run Benchmarks
run: |
Expand Down Expand Up @@ -169,6 +162,7 @@ jobs:
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
benchmark-data-dir-path: "benchmarks"
alert-threshold: "300%"
fail-on-alert: true
comment-on-alert: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
#summary-always: ${{ github.event_name != 'push' && github.event_name != 'workflow_dispatch' }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ jobs:
--tls-auth-clients no &
- name: Setup Redis Cluster
uses: vishnudxb/[email protected].8
uses: vishnudxb/[email protected].9
with:
master1-port: 7000
master2-port: 7001
master3-port: 7002
slave1-port: 7003
slave2-port: 7004
slave3-port: 7005
sleep-duration: 10

- name: Install Go
uses: actions/setup-go@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-rueidis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ jobs:
--tls-ca-cert-file /home/runner/work/storage/storage/tls/ca.crt &
- name: Setup Redis Cluster
uses: vishnudxb/[email protected].8
uses: vishnudxb/[email protected].9
with:
master1-port: 7000
master2-port: 7001
master3-port: 7002
slave1-port: 7003
slave2-port: 7004
slave3-port: 7005
sleep-duration: 10

- name: Install Go
uses: actions/setup-go@v4
Expand Down
2 changes: 1 addition & 1 deletion badger/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func Benchmark_Badger_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Badger_Delete(b *testing.B) {
func Benchmark_Badger_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

Expand Down
2 changes: 1 addition & 1 deletion bbolt/bbolt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func Benchmark_Bbolt_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_Bbolt_Delete(b *testing.B) {
func Benchmark_Bbolt_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

Expand Down
29 changes: 0 additions & 29 deletions memory/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"
"time"

"github.com/gofiber/utils/v2"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -120,34 +119,6 @@ func Test_Storage_Memory_Conn(t *testing.T) {
require.True(t, testStore.Conn() != nil)
}

// go test -v -run=^$ -bench=Benchmark_Storage_Memory -benchmem -count=4
func Benchmark_Storage_Memory(b *testing.B) {
keyLength := 1000
keys := make([]string, keyLength)
for i := 0; i < keyLength; i++ {
keys[i] = utils.UUID()
}
value := []byte("joe")

ttl := 2 * time.Second
b.Run("fiber_memory", func(b *testing.B) {
d := New()
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for _, key := range keys {
d.Set(key, value, ttl)
}
for _, key := range keys {
_, _ = d.Get(key)
}
for _, key := range keys {
d.Delete(key)
}
}
})
}

func Benchmark_Memory_Set(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
Expand Down
2 changes: 1 addition & 1 deletion sqlite3/sqlite3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func Benchmark_SQLite3_Get(b *testing.B) {
require.NoError(b, err)
}

func Benchmark_SQLite3_Delete(b *testing.B) {
func Benchmark_SQLite3_SetAndDelete(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

Expand Down

0 comments on commit f113998

Please sign in to comment.