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 df9a003
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,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 df9a003

Please sign in to comment.