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

提升测试覆盖率,增加go1.22的test action. #94

Merged
merged 19 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
"1.19",
"1.20",
"1.21",
"1.22",
]
runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions dcron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ func runSecondNode(id string, wg *sync.WaitGroup, runningTime time.Duration, t *
dcron.CronOptionChain(cron.Recover(
cron.DefaultLogger,
)),
dcron.WithHashReplicas(20),
dcron.CronOptionLocation(time.Local),
)
var err error
err = dcr.AddFunc("job1", "*/5 * * * * *", func() {
Expand Down
2 changes: 1 addition & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type DriverV2 interface {
// stop the goroutine of keep connection.
Stop(ctx context.Context) (err error)

withOption(opt Option) (err error)
WithOption(opt Option) (err error)
}

func NewRedisDriver(redisClient redis.UniversalClient) DriverV2 {
Expand Down
4 changes: 2 additions & 2 deletions driver/etcddriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (e *EtcdDriver) Init(serverName string, opts ...Option) {
e.serviceName = serverName
e.nodeID = GetNodeId(serverName)
for _, opt := range opts {
e.withOption(opt)
e.WithOption(opt)
}
}

Expand Down Expand Up @@ -204,7 +204,7 @@ func (e *EtcdDriver) Stop(ctx context.Context) (err error) {
return
}

func (e *EtcdDriver) withOption(opt Option) (err error) {
func (e *EtcdDriver) WithOption(opt Option) (err error) {
switch opt.Type() {
case OptionTypeTimeout:
{
Expand Down
4 changes: 2 additions & 2 deletions driver/redisdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (rd *RedisDriver) Init(serviceName string, opts ...Option) {
rd.nodeID = GetNodeId(rd.serviceName)

for _, opt := range opts {
rd.withOption(opt)
rd.WithOption(opt)
}
}

Expand Down Expand Up @@ -130,7 +130,7 @@ func (rd *RedisDriver) scan(ctx context.Context, matchStr string) ([]string, err
return ret, nil
}

func (rd *RedisDriver) withOption(opt Option) (err error) {
func (rd *RedisDriver) WithOption(opt Option) (err error) {
switch opt.Type() {
case OptionTypeTimeout:
{
Expand Down
4 changes: 2 additions & 2 deletions driver/rediszsetdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (rd *RedisZSetDriver) Init(serviceName string, opts ...Option) {
rd.serviceName = serviceName
rd.nodeID = GetNodeId(serviceName)
for _, opt := range opts {
rd.withOption(opt)
rd.WithOption(opt)
}
}

Expand Down Expand Up @@ -95,7 +95,7 @@ func (rd *RedisZSetDriver) Stop(ctx context.Context) (err error) {
return
}

func (rd *RedisZSetDriver) withOption(opt Option) (err error) {
func (rd *RedisZSetDriver) WithOption(opt Option) (err error) {
switch opt.Type() {
case OptionTypeTimeout:
{
Expand Down
84 changes: 43 additions & 41 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,82 @@ module github.com/libi/dcron
go 1.19

require (
github.com/alicebob/miniredis/v2 v2.31.0
github.com/alicebob/miniredis/v2 v2.32.1
github.com/google/uuid v1.5.0
github.com/redis/go-redis/v9 v9.3.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
go.etcd.io/etcd/api/v3 v3.5.11
go.etcd.io/etcd/client/v3 v3.5.11
go.etcd.io/etcd/tests/v3 v3.5.11
)

require (
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/prometheus/client_golang v1.11.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 // indirect
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.11 // indirect
go.etcd.io/etcd/client/v2 v2.305.11 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.11 // indirect
go.etcd.io/etcd/raft/v3 v3.5.11 // indirect
go.etcd.io/etcd/server/v3 v3.5.11 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/otel v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
go.opentelemetry.io/otel/metric v1.20.0 // indirect
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
go.opentelemetry.io/otel/trace v1.20.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
Loading