[Agent] [Executor] 优化Functional Executor

This commit is contained in:
zeaslity
2023-10-12 11:42:58 +08:00
parent 62712dfbce
commit 0a294fa81b
7 changed files with 136 additions and 71 deletions

View File

@@ -2,12 +2,36 @@ package executor
import "testing"
func TestReadTimeOutput(t *testing.T) {
strings := []string{
"/bin/bash",
"/root/IdeaProjects/ProjectOctopus/agent-go/tmp/simple.sh",
}
var closeSELinux = []string{
"sed",
"-i",
"s/SELINUX=enforcing/SELINUX=disabled/g",
"/etc/selinux/config",
}
AllOutputCommandExecutor(strings)
var callShellScript = []string{
"/bin/bash",
"/root/IdeaProjects/ProjectOctopus/agent-go/tmp/simple.sh",
}
var ifconfigCommand = []string{"ifconfig"}
func TestReadTimeOutput(t *testing.T) {
ReadTimeCommandExecutor(ifconfigCommand)
}
func TestAllCommandExecutor(t *testing.T) {
ok, result := AllCommandExecutor(ifconfigCommand)
t.Logf("执行结果为 => %#v", ok)
t.Logf("执行日志为 => %#v", result)
}
func TestPureResultSingleExecute(t *testing.T) {
PureResultSingleExecute(closeSELinux)
}