8000 [BUG] - job isn't executed silently if wrong list of params passed · Issue #142 · go-co-op/gocron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG] - job isn't executed silently if wrong list of params passed  #142
Closed
@mikhailbolshakov

Description

@mikhailbolshakov

Describe the bug

List of params passed to Do method must correspond to function, otherwise job isn't executed silently

To Reproduce

The following test reproduces the bug

``
func Test_SpecificTime_WithIncorrectParams(t *testing.T) {

quit := make(chan bool)

action := func(s1, s2 string) {
	fmt.Printf("fired: %s, %s", s1, s2)
	quit <- true
}

s := gocron.NewScheduler(time.UTC)
s.StartAsync()

j, err := s.Every(1).Day().StartAt(time.Now().UTC().Add(time.Second * 10)).Do(action, "s1")
if err != nil {
	t.Fatal()
}
fmt.Println("next run = ", j.NextRun())

select {
case <-time.After(time.Second * 20):
	fmt.Println("time out")
	t.Fatal()
case <-quit:
	fmt.Println("passed")
}

}
``

Version

1.0.0

Expected behavior

I suggest to return a n error from Do func if the list of passed params is wrong.
I could prepare a PR if you aren't against

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0