[ Agent ] [ Base ] - refresh for euler

This commit is contained in:
zeaslity
2024-01-24 17:09:48 +08:00
parent 2c1cde980c
commit 4ffd48500c
10 changed files with 111 additions and 104 deletions

View File

@@ -2,23 +2,26 @@ package executor
import (
"testing"
"wdd.io/agent-go/assert"
"wdd.io/agent-go/register"
)
var agentOP = &AgentOsOperator{
InstallCommandPrefix: []string{
"apt-get", "install", "-y",
"yum", "install", "-y",
},
RemoveCommandPrefix: []string{"apt", "remove", "-y"},
RemoveCommandPrefix: []string{"yum", "remove", "-y"},
CanAccessInternet: true,
IsOsTypeUbuntu: true,
IsOsTypeUbuntu: false,
IsOsTypeCentOS: true,
IsOsTypeEuler: true,
IsAgentInnerWall: true,
AgentArch: "amd64",
AgentOSReleaseCode: "focal",
AgentServerInfo: &register.AgentServerInfo{
ServerName: "",
ServerIPPbV4: "",
ServerIPInV4: "192.168.0.8",
ServerIPInV4: "10.250.0.147",
ServerIPPbV6: "",
ServerIPInV6: "",
Location: "",
@@ -39,23 +42,39 @@ var agentOP = &AgentOsOperator{
AgentVersion: "",
TopicName: "",
},
OssOfflinePrefix: "http://10.250.0.100:9000/octopus/",
}
func TestBaseFunc(t *testing.T) {
//agentOP.Command("shutdownFirewall")
//agentOP.Command("modifyHostname")
//agentOP.Command("disableSwap")
//agentOP.Command("enableSwap")
//agentOP.Command("removeDocker")
//agentOP.Command("installDocker", "20")
//agentOP.Command("removeDockerCompose")
//agentOP.Command("installDockerCompose")
//agentOP.Command("installHelm")
//agentOP.Command("installHarbor")
//agentOP.Command("chronyToPublicNTP")
//agentOP.Command("chronyToMaster", "192.168.0.8")
//agentOP.Command("installZSH")
agentOP.Command("ok")
//command := "DISABLE_SELINUX"
//command := "installDocker"
//command := "installDockerCompose"
command := "installHarbor"
funcArgs := []string{
"10.250.0.147",
"",
"",
"",
}
//agentOP.Exec("shutdownFirewall")
//agentOP.Exec("modifyHostname")
//agentOP.Exec("disableSwap")
//agentOP.Exec("enableSwap")
//agentOP.Exec("removeDocker")
//agentOP.Exec("installDocker", "20")
//agentOP.Exec("removeDockerCompose")
//agentOP.Exec("installDockerCompose")
//agentOP.Exec("installHelm")
//agentOP.Exec("installHarbor")
//agentOP.Exec("chronyToMaster", "192.168.0.8")
//agentOP.Exec("installZSH")
//agentOP.Exec("ok")
exec, strings := agentOP.Exec(command, funcArgs...)
assert.Equal(t, exec, true, "exec should be true!")
t.Logf("[%s] exec result are %s", command, strings)
}