-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtask_test.go
45 lines (38 loc) · 991 Bytes
/
task_test.go
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
package arseeding
import (
"github.com/everFinance/arseeding/schema"
"github.com/everFinance/goar"
"github.com/stretchr/testify/assert"
"os"
"testing"
)
func TestTasks(t *testing.T) {
arId := "O3VwBusl0PNKusWcDF44uPt-sNuhywgeKxOmQpDqGc0"
tkm := NewTaskMg()
tk := &schema.Task{}
tkm.taskMap = map[string]*schema.Task{
schema.TaskTypeSync + "-" + arId: tk,
schema.TaskTypeBroadcast + "-" + arId: tk,
schema.TaskTypeBroadcastMeta + "-" + arId: tk,
}
dbPath := "./data/tmp.db"
s, err := NewBoltStore(dbPath)
assert.NoError(t, err)
cli := goar.NewClient("https://arweave.net")
aa := &Arseeding{
store: s,
taskMg: tkm,
arCli: cli,
cache: NewCache(cli, nil),
}
err = aa.syncTask(arId)
assert.NoError(t, err)
err = aa.broadcastTxMetaTask(arId)
assert.NoError(t, err)
err = aa.broadcastTxTask(arId)
assert.NoError(t, err)
err = aa.setProcessedTask(arId, "sync")
assert.NoError(t, err)
err = os.RemoveAll(dbPath)
assert.NoError(t, err)
}