Skip to content

Commit

Permalink
✨ Add test params (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Apr 8, 2024
1 parent f4430e7 commit 735f777
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_SQLITE }}
run: |
CI_DATABASE_TYPE=sqlite3 go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
CI_DATABASE_TYPE=sqlite3 go test -parallel 1 -failfast -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
- name: Run tests
if: ${{ github.event_name == 'pull_request' }}
env:
Expand All @@ -93,7 +93,7 @@ jobs:
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_SQLITE }}
run: |
CI_DATABASE_TYPE=sqlite3 go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
CI_DATABASE_TYPE=sqlite3 go test -parallel 1 -failfast -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_POSTGRESQL }}
run: |
CI_DATABASE_TYPE=postgresql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
CI_DATABASE_TYPE=postgresql go test -parallel 1 -failfast -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
- name: Run tests
if: ${{ github.event_name == 'pull_request' }}
env:
Expand All @@ -182,7 +182,7 @@ jobs:
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_POSTGRESQL }}
run: |
CI_DATABASE_TYPE=postgresql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
CI_DATABASE_TYPE=postgresql go test -parallel 1 -failfast -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_MYSQL }}
run: |
CI_DATABASE_TYPE=mysql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
CI_DATABASE_TYPE=mysql go test -parallel 1 -failfast -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
- name: Run tests
if: ${{ github.event_name == 'pull_request' }}
env:
Expand All @@ -272,7 +272,7 @@ jobs:
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_MYSQL }}
run: |
CI_DATABASE_TYPE=mysql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
CI_DATABASE_TYPE=mysql go test -parallel 1 -failfast -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions pkg/modules/locker/definition/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

package definition

//go:generate mockgen -destination=mocks/lock.go -package=mocks github.com/go-sigma/sigma/pkg/modules/locker/definition Lock
//go:generate mockgen -destination=mocks/locker.go -package=mocks github.com/go-sigma/sigma/pkg/modules/locker/definition Locker

import (
"context"
"errors"
Expand Down
74 changes: 74 additions & 0 deletions pkg/modules/locker/definition/mocks/lock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions pkg/modules/locker/definition/mocks/locker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/signing/definition/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ package definition

import "context"

//go:generate mockgen -destination=mocks/signing.go -package=mocks github.com/go-sigma/sigma/pkg/signing/definition Signing
//go:generate mockgen -destination=mocks/verifying.go -package=mocks github.com/go-sigma/sigma/pkg/signing/definition Verifying

// Signing ...
type Signing interface {
Sign(ctx context.Context, token, priKey, ref string) error
Expand Down
54 changes: 54 additions & 0 deletions pkg/signing/definition/mocks/signing.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions pkg/signing/definition/mocks/verifying.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pkg/tests/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"strings"
"testing"

"github.com/alicebob/miniredis/v2"
"github.com/spf13/viper"

"github.com/go-sigma/sigma/pkg/types/enums"
Expand Down Expand Up @@ -58,9 +57,6 @@ func Initialize(t *testing.T) error {
viper.AutomaticEnv()
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))

miniRedis := miniredis.RunT(t)
viper.SetDefault("redis.url", "redis://"+miniRedis.Addr())

typ := viper.GetString("ci.database.type")
if typ == "" {
typ = enums.DatabaseSqlite3.String()
Expand Down

0 comments on commit 735f777

Please sign in to comment.