[Agent] [Executor] 重写BaseFunction

This commit is contained in:
zeaslity
2023-10-16 15:34:06 +08:00
parent 020fc76e05
commit db58a7a6f6
3 changed files with 192 additions and 6 deletions

View File

@@ -5,7 +5,8 @@ import (
"testing"
)
var emptyFilePath = "/home/wdd/IdeaProjects/ProjectOctopus/agent-go/executor/script"
var emptyFilePath = "/home/wdd/IdeaProjects/ProjectOctopus/agent-go/executor/script/123"
var noExistFilePath = "/home/wdd/IdeaProjects/ProjectOctopus/agent-go/executor/script/456"
func TestBasicFileExistAndNotNull(t *testing.T) {
@@ -14,3 +15,25 @@ func TestBasicFileExistAndNotNull(t *testing.T) {
assert.Equal(t, resultOK, false, "判定为空文件返回false")
}
func TestBasicReplaceFileNotExists(t *testing.T) {
replace := BasicReplace(noExistFilePath, "123", "123")
t.Logf("replace no exists file result are => %#v", replace)
}
func TestBasicFileExists(t *testing.T) {
exists := BasicFileExists(emptyFilePath)
assert.Equal(t, exists, true, "文件存在但是为空应该返回true")
}
func TestBasicFileExistFalse(t *testing.T) {
exists := BasicFileExists(noExistFilePath)
assert.Equal(t, exists, false, "文件不存在应该返回false")
}