Skip to content

Commit

Permalink
提升测试覆盖率,增加go1.22的test action. (#94)
Browse files Browse the repository at this point in the history
* chore: use `redis.UniversalClient` instead of `*redis.Client` (#88)

* make dcron running locally, update cron test, add GetJobs / GetJob function for dcron. (#89)

* 增加code coverage, 修复GetJob bug,增加devcontainer方便开发者 (#91)

* add example app to readme

* add NodeID function into dcron

* Deps: updated github.com/go-redis/redis/v8 to github.com/redis/go-redis/v9 (#73)

* add cron lib

* fix warning

* logger removal : phares1

* update

* update

* update

* add robfig/cron to dcron (#75)

* add NodeID function into dcron

* add cron lib

* fix warning

* logger removal : phares1

* update

* update

* update

* update

* update

* update

* update

* update test workflow

* revert 1.22

* update etcd driver

* update

* fix get nodes

* update

* update for fix TAT

* Revert "update etcd driver"

This reverts commit a21ebf7.

* Revert "deps: updated go-redis to v9 (#79)"

This reverts commit 0b85b24.

* update

* update

* refact etcd

* Revert "refact etcd"

This reverts commit 049bed1.

* Revert "update"

This reverts commit 9c71fd6.

* update

* refactor etcddriver

* fix error

* update

* Revert "update"

This reverts commit 6cfcfe6.

* Revert "fix error"

This reverts commit 99b2d82.

* Revert "refactor etcddriver"

This reverts commit a576ac3.

* update

* update

* remove comments, and fix

* add comments

* Add comments, add split the E2E test cases and other test cases. (#80)

* add example app to readme

* add NodeID function into dcron

* add cron lib

* fix warning

* logger removal : phares1

* update

* update

* update

* update

* update

* update

* update

* update test workflow

* revert 1.22

* update etcd driver

* update

* fix get nodes

* update

* update for fix TAT

* Revert "update etcd driver"

This reverts commit a21ebf7.

* Revert "deps: updated go-redis to v9 (#79)"

This reverts commit 0b85b24.

* update

* update

* refact etcd

* Revert "refact etcd"

This reverts commit 049bed1.

* Revert "update"

This reverts commit 9c71fd6.

* update

* refactor etcddriver

* fix error

* update

* Revert "update"

This reverts commit 6cfcfe6.

* Revert "fix error"

This reverts commit 99b2d82.

* Revert "refactor etcddriver"

This reverts commit a576ac3.

* update

* update

* remove comments, and fix

* add comments

* merge e2e test and normal test

* move e2etest to origin path

* add timeout to avoid pipeline timeout

* add getjobs related function

* update

* remove redis config in test workflow

* update

* update chain test in windows

* update action version for node 16 -> node 20

* add test for dcron locally

* update readme

* update

* fix code bug

* Update devcontainer and etcd driver test

---------

Co-authored-by: Ava Ackerman <withrjp@gmail.com>
Co-authored-by: libi <7769922+libi@users.noreply.github.com>

* update test coverage

* make driver withOption -> WithOption

* update go.mod

* update go.mod

* update protobuf version

* etcd to 3.5.12

* fix etcd

* fix etcd

* Revert "fix etcd"

This reverts commit a21bf33.

* update miniredis

* update

* update go.mod

* update go mod

* update go mod

---------

Co-authored-by: AHdark <ahdark@outlook.com>
Co-authored-by: Ava Ackerman <withrjp@gmail.com>
Co-authored-by: libi <7769922+libi@users.noreply.github.com>
  • Loading branch information
4 people authored Apr 24, 2024
1 parent eb11c9b commit 4b59695
Show file tree
Hide file tree
Showing 12 changed files with 305 additions and 151 deletions.
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

0 comments on commit 4b59695

Please sign in to comment.