Rainbond/util/ansible/node_test.go
2019-12-05 17:54:51 +08:00

33 lines
583 B
Go

package ansible
import (
"testing"
)
func TestPreCheckNodeInstall(t *testing.T) {
tests := []struct {
name string
opt *NodeInstallOption
wanterr bool
}{
{
name: "empty node id",
opt: &NodeInstallOption{
HostRole: "host role",
InternalIP: "192.168.1.1",
RootPass: "root pass",
},
wanterr: true,
},
}
for idx := range tests {
tc := tests[idx]
t.Run(tc.name, func(t *testing.T) {
if err := preCheckNodeInstall(tc.opt); (err != nil) != tc.wanterr {
t.Errorf("want error: %v, but got %v", tc.wanterr, err)
}
})
}
}