Test: cluster/node.go and controller.go

This commit is contained in:
HFO4
2021-11-15 20:30:25 +08:00
parent 416f4c1dd2
commit 6c9967b120
7 changed files with 415 additions and 9 deletions

17
pkg/cluster/node_test.go Normal file
View File

@@ -0,0 +1,17 @@
package cluster
import (
model "github.com/cloudreve/Cloudreve/v3/models"
"github.com/stretchr/testify/assert"
"testing"
)
func TestNewNodeFromDBModel(t *testing.T) {
a := assert.New(t)
a.IsType(&SlaveNode{}, NewNodeFromDBModel(&model.Node{
Type: model.SlaveNodeType,
}))
a.IsType(&MasterNode{}, NewNodeFromDBModel(&model.Node{
Type: model.MasterNodeType,
}))
}