mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-15 15:16:34 +08:00
实现DNS节点远程安装
This commit is contained in:
39
internal/installers/installer_ns_node_test.go
Normal file
39
internal/installers/installer_ns_node_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package installers
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDNSNodeInstaller_Install(t *testing.T) {
|
||||
var installer InstallerInterface = &DNSNodeInstaller{}
|
||||
err := installer.Login(&Credentials{
|
||||
Host: "192.168.2.30",
|
||||
Port: 22,
|
||||
Username: "root",
|
||||
Password: "123456",
|
||||
PrivateKey: "",
|
||||
Method: "user",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// 关闭连接
|
||||
defer func() {
|
||||
err := installer.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
|
||||
// 安装
|
||||
err = installer.Install("/opt/edge", &NodeParams{
|
||||
Endpoints: []string{"http://192.168.2.40:8003"},
|
||||
NodeId: "b3f0690c793db5daaa666e89bd7b2301",
|
||||
Secret: "H6nbSzjN3tLYi0ecdtUeDpQdZZPjKL7S",
|
||||
}, &models.NodeInstallStatus{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user