Files
EdgeAPI/internal/db/models/node_dao_test.go

37 lines
699 B
Go
Raw Normal View History

2020-07-22 22:17:53 +08:00
package models
import (
_ "github.com/go-sql-driver/mysql"
"github.com/iwind/TeaGo/dbs"
2020-08-21 12:32:33 +08:00
"testing"
2020-07-22 22:17:53 +08:00
)
2020-08-21 12:32:33 +08:00
func TestNodeDAO_FindAllNodeIdsMatch(t *testing.T) {
2021-01-10 17:34:35 +08:00
var tx *dbs.Tx
2021-08-01 21:54:44 +08:00
nodeIds, err := SharedNodeDAO.FindAllNodeIdsMatch(tx, 1, true, 0)
2020-08-21 12:32:33 +08:00
if err != nil {
t.Fatal(err)
}
t.Log(nodeIds)
}
func TestNodeDAO_UpdateNodeUp(t *testing.T) {
dbs.NotifyReady()
2021-01-10 17:34:35 +08:00
var tx *dbs.Tx
2021-04-12 19:19:15 +08:00
err := SharedNodeDAO.UpdateNodeUp(tx, 57, false)
if err != nil {
t.Fatal(err)
}
2021-04-12 19:19:15 +08:00
t.Log("ok")
}
2021-07-31 22:23:11 +08:00
func TestNodeDAO_FindEnabledNodeClusterIds(t *testing.T) {
dbs.NotifyReady()
var tx *dbs.Tx
clusterIds, err := NewNodeDAO().FindEnabledAndOnNodeClusterIds(tx, 48)
if err != nil {
t.Fatal(err)
}
t.Log(clusterIds)
}