Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stretchr/testify & update min version to go1.19 #933

Merged
merged 18 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '^1.18.x'
go-version: '^1.19.x'
check-latest: true
cache: false
- name: Install Gosec
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-arangodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-azureblob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
gaby marked this conversation as resolved.
Show resolved Hide resolved
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Install Azurite
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-badger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-bbolt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-couchbase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-dynamodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-etcd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-memcache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-memory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-mongodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-pebble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
redis:
- '6.x'
- '7.x'
Expand All @@ -41,7 +41,7 @@ jobs:
--tls-ca-cert-file ./redis/tests/tls/ca.crt&

- name: Setup Redis Cluster
uses: vishnudxb/redis-cluster@1.0.5
uses: vishnudxb/redis-cluster@1.0.8
with:
master1-port: 7000
master2-port: 7001
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ristretto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Fetch Repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
steps:
- name: Install MinIO
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-sqlite3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
Expand Down
2 changes: 2 additions & 0 deletions arangodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ title: ArangoDB

A ArangoDB storage driver using `arangodb/go-driver` and [arangodb/go-driver](https://github.com/arangodb/go-driver).

**Note: Requires Go 1.19 and above**

### Table of Contents
- [Signatures](#signatures)
- [Installation](#installation)
Expand Down
2 changes: 1 addition & 1 deletion arangodb/arangodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/http"
"github.com/gofiber/utils"
"github.com/gofiber/utils/v2"
)

// Storage interface that is implemented by storage providers
Expand Down
65 changes: 30 additions & 35 deletions arangodb/arangodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

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

var testStore = New(Config{
Expand All @@ -18,7 +18,7 @@ func Test_ARANGODB_Set(t *testing.T) {
)

err := testStore.Set(key, val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)
}

func Test_ARANGODB_Upsert(t *testing.T) {
Expand All @@ -28,10 +28,10 @@ func Test_ARANGODB_Upsert(t *testing.T) {
)

err := testStore.Set(key, val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

err = testStore.Set(key, val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)
}

func Test_ARANGODB_Get(t *testing.T) {
Expand All @@ -41,11 +41,11 @@ func Test_ARANGODB_Get(t *testing.T) {
)

err := testStore.Set(key, val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

result, err := testStore.Get(key)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, val, result)
require.NoError(t, err)
require.Equal(t, val, result)
}

func Test_ARANGODB_Set_Expiration(t *testing.T) {
Expand All @@ -56,26 +56,23 @@ func Test_ARANGODB_Set_Expiration(t *testing.T) {
)

err := testStore.Set(key, val, exp)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

time.Sleep(1100 * time.Millisecond)
}

func Test_ARANGODB_Get_Expired(t *testing.T) {
var (
key = "john"
)
key := "john"

result, err := testStore.Get(key)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(result) == 0)
require.NoError(t, err)
require.Zero(t, len(result))
}

func Test_ARANGODB_Get_NotExist(t *testing.T) {

result, err := testStore.Get("notexist")
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(result) == 0)
require.NoError(t, err)
require.Zero(t, len(result))
}

func Test_ARANGODB_Delete(t *testing.T) {
Expand All @@ -85,54 +82,52 @@ func Test_ARANGODB_Delete(t *testing.T) {
)

err := testStore.Set(key, val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

err = testStore.Delete(key)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

result, err := testStore.Get(key)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(result) == 0)
require.NoError(t, err)
require.Zero(t, len(result))
}

func Test_ARANGODB_Reset(t *testing.T) {
var (
val = []byte("doe")
)
val := []byte("doe")

err := testStore.Set("john1", val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

err = testStore.Set("john2", val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

err = testStore.Reset()
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

result, err := testStore.Get("john1")
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(result) == 0)
require.NoError(t, err)
require.Zero(t, len(result))

result, err = testStore.Get("john2")
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(result) == 0)
require.NoError(t, err)
require.Zero(t, len(result))
}

func Test_ARANGODB_Non_UTF8(t *testing.T) {
val := []byte("0xF5")

err := testStore.Set("0xF6", val, 0)
utils.AssertEqual(t, nil, err)
require.NoError(t, err)

result, err := testStore.Get("0xF6")
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, val, result)
require.NoError(t, err)
require.Equal(t, val, result)
}

func Test_ARANGODB_Close(t *testing.T) {
utils.AssertEqual(t, nil, testStore.Close())
require.Nil(t, testStore.Close())
}

func Test_ARANGODB_Conn(t *testing.T) {
utils.AssertEqual(t, true, testStore.Conn() != nil)
require.True(t, testStore.Conn() != nil)
}
Loading
Loading