Skip to content

Commit

Permalink
fix unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
davies authored and zhoucheng361 committed Aug 30, 2023
1 parent eaa87da commit 6727b5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ test.meta.core:
SKIP_NON_CORE=true go test -v -cover -count=1 -failfast -timeout=12m ./pkg/meta/... -coverprofile=cov.out

test.meta.non-core:
go test -v -cover -run='TestRedisCluster|TestPostgreSQLClient|TestLoadDumpSlow|TestEtcdClient|TestKeyDB' -count=1 -failfast -timeout=12m ./pkg/meta/... -coverprofile=cov.out
go test -v -cover -run='TestPostgreSQLClient|TestLoadDumpSlow|TestEtcdClient' -count=1 -failfast -timeout=12m ./pkg/meta/... -coverprofile=cov.out

test.pkg:
go test -tags gluster -v -cover -count=1 -failfast -timeout=12m $$(go list ./pkg/... | grep -v /meta) -coverprofile=cov.out

test.cmd:
sudo JFS_GC_SKIPPEDTIME=1 MINIO_ACCESS_KEY=testUser MINIO_SECRET_KEY=testUserPassword GOMAXPROCS=8 go test -v -count=1 -failfast -cover -timeout=8m ./cmd/... -coverprofile=cov.out -coverpkg=./pkg/...,./cmd/...

test.fdb:
go test -v -cover -count=1 -failfast -timeout=4m ./pkg/meta/ -tags fdb -run=TestFdb -coverprofile=cov.out
sudo JFS_GC_SKIPPEDTIME=1 MINIO_ACCESS_KEY=testUser MINIO_SECRET_KEY=testUserPassword GOMAXPROCS=8 go test -v -count=1 -failfast -cover -timeout=8m ./cmd/... -coverprofile=cov.out -coverpkg=./pkg/...,./cmd/...
4 changes: 4 additions & 0 deletions pkg/meta/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"bytes"
"context"
"fmt"
"os"
"reflect"
"runtime"
"strconv"
Expand All @@ -43,6 +44,9 @@ func TestRedisClient(t *testing.T) {
}

func TestRedisCluster(t *testing.T) {
if os.Getenv("SKIP_NON_CORE") == "true" {
t.Skipf("skip non-core test")
}
var conf = Config{MaxDeletes: 2}
m, err := newRedisMeta("redis", "127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003/2", &conf)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/clock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestClock(t *testing.T) {
}
c1 := Clock()
c2 := Clock()
if c2-c1 > time.Microsecond || c2-c1 == 0 {
t.Fatalf("clock is not accurate: %s", c2-c1)
if c2 < c1 {
t.Fatalf("clock is not monotonic: %s > %s", c1, c2)
}
}

0 comments on commit 6727b5d

Please sign in to comment.