2020-09-06 16:19:54 +08:00
|
|
|
package installers
|
|
|
|
|
|
2020-10-27 12:33:22 +08:00
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
2020-09-06 16:19:54 +08:00
|
|
|
|
|
|
|
|
func TestNodeInstaller_Install(t *testing.T) {
|
|
|
|
|
var installer InstallerInterface = &NodeInstaller{}
|
|
|
|
|
err := installer.Login(&Credentials{
|
|
|
|
|
Host: "192.168.2.30",
|
|
|
|
|
Port: 22,
|
|
|
|
|
Username: "root",
|
|
|
|
|
Password: "123456",
|
|
|
|
|
PrivateKey: "",
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 关闭连接
|
|
|
|
|
defer func() {
|
|
|
|
|
err := installer.Close()
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// 安装
|
|
|
|
|
err = installer.Install("/opt/edge", &NodeParams{
|
2021-08-11 21:00:29 +08:00
|
|
|
Endpoints: []string{"http://192.168.2.40:8003"},
|
2020-09-13 20:37:28 +08:00
|
|
|
NodeId: "313fdb1b90d0a63c736f307b4d1ca358",
|
|
|
|
|
Secret: "Pl3u5kYqBDZddp7raw6QfHiuGPRCWF54",
|
2020-10-27 12:33:22 +08:00
|
|
|
}, &models.NodeInstallStatus{})
|
2020-09-06 16:19:54 +08:00
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
}
|