[ Cmii ] [ Octopus ] - reformat agent-go - 1
This commit is contained in:
80
agent-go/a_executor/BaseFunction_test.go
Normal file
80
agent-go/a_executor/BaseFunction_test.go
Normal file
@@ -0,0 +1,80 @@
|
||||
package a_executor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"wdd.io/agent-common/assert"
|
||||
"wdd.io/agent-go/a_agent"
|
||||
)
|
||||
|
||||
var agentOP = &AgentOsOperator{
|
||||
InstallCommandPrefix: []string{
|
||||
"yum", "install", "-y",
|
||||
},
|
||||
RemoveCommandPrefix: []string{"yum", "remove", "-y"},
|
||||
CanAccessInternet: true,
|
||||
IsOsTypeUbuntu: false,
|
||||
IsOsTypeCentOS: true,
|
||||
IsOsTypeEuler: true,
|
||||
IsAgentInnerWall: true,
|
||||
AgentArch: "amd64",
|
||||
AgentOSReleaseCode: "focal",
|
||||
AgentServerInfo: &a_agent.AgentServerInfo{
|
||||
ServerName: "",
|
||||
ServerIPPbV4: "",
|
||||
ServerIPInV4: "10.250.0.100",
|
||||
ServerIPPbV6: "",
|
||||
ServerIPInV6: "",
|
||||
Location: "",
|
||||
Provider: "",
|
||||
ManagePort: "",
|
||||
CPUCore: "",
|
||||
CPUBrand: "",
|
||||
OSInfo: "",
|
||||
OSKernelInfo: "",
|
||||
TCPControl: "",
|
||||
Virtualization: "",
|
||||
IoSpeed: "",
|
||||
MemoryTotal: "",
|
||||
DiskTotal: "",
|
||||
DiskUsage: "",
|
||||
Comment: "",
|
||||
MachineID: "",
|
||||
AgentVersion: "",
|
||||
TopicName: "",
|
||||
},
|
||||
OssOfflinePrefix: "http://10.250.0.100:9000/octopus/",
|
||||
}
|
||||
|
||||
func TestBaseFunc(t *testing.T) {
|
||||
|
||||
//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)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user