2020-07-22 22:17:53 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
_ "github.com/go-sql-driver/mysql"
|
2020-11-15 21:17:42 +08:00
|
|
|
"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
|
|
|
|
|
nodeIds, err := SharedNodeDAO.FindAllNodeIdsMatch(tx, 1)
|
2020-08-21 12:32:33 +08:00
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
t.Log(nodeIds)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestNodeDAO_FindChangedClusterIds(t *testing.T) {
|
2021-01-10 17:34:35 +08:00
|
|
|
var tx *dbs.Tx
|
|
|
|
|
clusterIds, err := SharedNodeDAO.FindChangedClusterIds(tx)
|
2020-08-21 12:32:33 +08:00
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
t.Log(clusterIds)
|
|
|
|
|
}
|
2020-11-15 21:17:42 +08:00
|
|
|
|
|
|
|
|
func TestNodeDAO_UpdateNodeUp(t *testing.T) {
|
|
|
|
|
dbs.NotifyReady()
|
2021-01-10 17:34:35 +08:00
|
|
|
var tx *dbs.Tx
|
|
|
|
|
isChanged, err := SharedNodeDAO.UpdateNodeUp(tx, 57, false, 3, 3)
|
2020-11-15 21:17:42 +08:00
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
t.Log("changed:", isChanged)
|
|
|
|
|
}
|