2023-10-25 12:23:25 +00:00
|
|
|
package lpwindow
|
2023-09-05 16:29:39 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-10-11 22:51:46 +00:00
|
|
|
"testing"
|
|
|
|
|
2023-09-05 16:29:39 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/dline"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
|
|
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
|
|
|
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
2023-10-11 22:51:46 +00:00
|
|
|
"github.com/filecoin-project/lotus/node/config"
|
2023-09-05 16:29:39 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
// test to create WDPostTask, invoke AddTask and check if the task is added to the DB
|
|
|
|
func TestAddTask(t *testing.T) {
|
2023-10-11 22:51:46 +00:00
|
|
|
db, err := harmonydb.NewFromConfig(config.HarmonyDB{
|
|
|
|
Hosts: []string{"localhost"},
|
|
|
|
Port: "5433",
|
|
|
|
Username: "yugabyte",
|
|
|
|
Password: "yugabyte",
|
|
|
|
Database: "yugabyte",
|
|
|
|
})
|
2023-09-05 16:29:39 +00:00
|
|
|
require.NoError(t, err)
|
2023-10-11 22:51:46 +00:00
|
|
|
wdPostTask := NewWdPostTask(db, nil, 0)
|
2023-09-05 16:29:39 +00:00
|
|
|
taskEngine, err := harmonytask.New(db, []harmonytask.TaskInterface{wdPostTask}, "localhost:12300")
|
2023-10-25 12:23:25 +00:00
|
|
|
_ = taskEngine
|
2023-09-05 16:29:39 +00:00
|
|
|
ts := types.TipSet{}
|
|
|
|
deadline := dline.Info{}
|
2023-10-25 12:23:25 +00:00
|
|
|
err = wdPostTask.AddTask(context.Background(), &ts, &deadline)
|
2023-09-05 16:29:39 +00:00
|
|
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|