-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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> --------- 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
1 parent
68982eb
commit f85cbd3
Showing
16 changed files
with
479 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"golang.go", | ||
"eamodio.gitlens" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# cron | ||
|
||
fork from [robfig/cron](github.com/robfig/cron) | ||
fork from [robfig/cron](github.com/robfig/cron) | ||
|
||
maintain by Dcron opensource team. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package dcron_test | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/libi/dcron" | ||
"github.com/libi/dcron/cron" | ||
"github.com/stretchr/testify/require" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type DcronLocallyTestSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *DcronLocallyTestSuite) TestNormal() { | ||
dcr := dcron.NewDcronWithOption( | ||
"not a necessary servername", | ||
nil, | ||
dcron.RunningLocally(), | ||
dcron.CronOptionSeconds(), | ||
dcron.CronOptionChain( | ||
cron.Recover( | ||
cron.DefaultLogger, | ||
))) | ||
|
||
s.Assert().NotNil(dcr) | ||
runningTime := 60 * time.Second | ||
t := s.T() | ||
var err error | ||
err = dcr.AddFunc("job1", "*/5 * * * * *", func() { | ||
t.Log(time.Now()) | ||
}) | ||
require.Nil(t, err) | ||
err = dcr.AddFunc("job2", "*/8 * * * * *", func() { | ||
panic("test panic") | ||
}) | ||
require.Nil(t, err) | ||
err = dcr.AddFunc("job3", "*/2 * * * * *", func() { | ||
t.Log("job3:", time.Now()) | ||
}) | ||
require.Nil(t, err) | ||
dcr.Start() | ||
<-time.After(runningTime) | ||
dcr.Stop() | ||
} | ||
|
||
func TestDcronLocallyTestSuite(t *testing.T) { | ||
suite.Run(t, &DcronLocallyTestSuite{}) | ||
} |
Oops, something went wrong.