[Cmii][ImageSync] -Image Function accomplish -1
This commit is contained in:
@@ -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++ {
|
||||
|
||||
Reference in New Issue
Block a user