github.com/godaddy-x/freego@v1.0.156/cronjob_test.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/godaddy-x/freego/job"
     6  	"github.com/godaddy-x/freego/utils"
     7  	"testing"
     8  )
     9  
    10  func TestJobTask(t *testing.T) {
    11  	task1 := job.Task{
    12  		Spec: "*/5 * * * * *",
    13  		Func: func() {
    14  			fmt.Println("job task1: ", utils.UnixMilli())
    15  		},
    16  	}
    17  	task2 := job.Task{
    18  		Spec: "*/10 * * * * *",
    19  		Func: func() {
    20  			fmt.Println("job task2: ", utils.UnixMilli())
    21  		},
    22  	}
    23  	job.Run(task1, task2)
    24  }