[Cmii][ImageSync] -Image Function accomplish -1

This commit is contained in:
zeaslity
2024-03-26 17:17:46 +08:00
committed by zeaslity
parent d800d5dfb8
commit 2b53db2141
14 changed files with 245 additions and 52 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"reflect"
"strings"
"testing"
)
@@ -133,6 +134,47 @@ func TestPipelineCommandExecutor(t *testing.T) {
BasicPrettyPrint(ok, resultLog)
}
func TestPipelineCommandExecutor2(t *testing.T) {
// Test case 1: Empty pipeline
pipelineCommand := [][]string{}
ok, log := PipelineCommandExecutor(pipelineCommand)
if !ok {
t.Errorf("Expected success, got failure")
}
if len(log) != 0 {
t.Errorf("Expected no log, got %v", log)
}
// Test case 2: Single command in pipeline
pipelineCommand = [][]string{
{"echo", "Hello, world!"},
}
ok, log = PipelineCommandExecutor(pipelineCommand)
if !ok {
t.Errorf("Expected success, got failure")
}
expectedLog := []string{"Hello, world!"}
if !reflect.DeepEqual(log, expectedLog) {
t.Errorf("Expected log %v, got %v", expectedLog, log)
}
// Test case 3: Multiple commands in pipeline
pipelineCommand = [][]string{
{"echo", "Hello"},
{"echo", "world!"},
}
ok, log = PipelineCommandExecutor(pipelineCommand)
if !ok {
t.Errorf("Expected success, got failure")
}
expectedLog = []string{"Hello", "world!"}
if !reflect.DeepEqual(log, expectedLog) {
t.Errorf("Expected log %v, got %v", expectedLog, log)
}
// Add more test cases as needed...
}
func TestSimple(t *testing.T) {
for i := 0; i < 10; i++ {