-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask_test.go
More file actions
70 lines (65 loc) · 1.25 KB
/
task_test.go
File metadata and controls
70 lines (65 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package conversion
import (
"errors"
"github.com/glvd/go-fftool"
"path/filepath"
"testing"
"time"
_ "github.com/gocacher/badger-cache/easy"
"github.com/gotrait/tool"
)
func init() {
RegisterDatabase(MustDatabase(InitSQLite3("conv.db")))
e := SyncTable()
if e != nil {
panic(e)
}
CachePath = "d:\\cache" //windows path test
RegisterCache()
fftool.DefaultCommandPath = filepath.Join(`D:\workspace\golang\project\go-fftool\bin`)
InitFFTool()
}
// TestTask_Start ...
func TestTask_Start(t *testing.T) {
task := NewTask()
for i := 0; i < 5; i++ {
id := tool.GenerateRandomString(5)
v, e := NewSourceWork(&VideoSource{
VideoPath: []string{"D:\\video\\demo-r-24.mp4"},
Bangumi: id,
})
if e != nil {
t.Fatal(e)
}
e = task.AddWorker(v, false)
if e != nil {
t.Fatal(e)
}
id = tool.GenerateRandomString(2)
v1, e1 := NewInfoWork(&VideoInfo{
ID: id,
})
if e1 != nil {
t.Fatal(e1)
}
e = task.AddWorker(v1, false)
if e != nil {
t.Fatal(e)
}
time.Sleep(1 * time.Microsecond)
}
log.Info("running")
task.Limit = 2
go func() {
time.Sleep(30 * time.Second)
//task.Stop()
}()
e := task.Start()
if e != nil {
t.Fatal(e)
}
}
// TestWrap ...
func TestWrap(t *testing.T) {
t.Log(Wrap(errors.New("err")))
}