@@ -18,6 +18,7 @@ func TestExecCommand_Run(t *testing.T) {
1818 type fields struct {
1919 params * chaos.GlobalParams
2020 command string
21+ args []string
2122 limit int
2223 }
2324 type args struct {
@@ -38,7 +39,8 @@ func TestExecCommand_Run(t *testing.T) {
3839 params : & chaos.GlobalParams {
3940 Names : []string {"c1" , "c2" },
4041 },
41- command : "kill 1" ,
42+ command : "kill" ,
43+ args : []string {"-9" },
4244 },
4345 args : args {
4446 ctx : context .TODO (),
@@ -52,7 +54,8 @@ func TestExecCommand_Run(t *testing.T) {
5254 Names : []string {"c1" , "c2" , "c3" },
5355 Labels : []string {"key=value" },
5456 },
55- command : "kill 1" ,
57+ command : "ls" ,
58+ args : []string {"-la" },
5659 },
5760 args : args {
5861 ctx : context .TODO (),
@@ -65,7 +68,8 @@ func TestExecCommand_Run(t *testing.T) {
6568 params : & chaos.GlobalParams {
6669 Pattern : "^c?" ,
6770 },
68- command : "kill -STOP 1" ,
71+ command : "kill" ,
72+ args : []string {"-STOP" , "1" },
6973 limit : 2 ,
7074 },
7175 args : args {
@@ -79,7 +83,8 @@ func TestExecCommand_Run(t *testing.T) {
7983 params : & chaos.GlobalParams {
8084 Names : []string {"c1" , "c2" , "c3" },
8185 },
82- command : "kill 1" ,
86+ command : "kill" ,
87+ args : []string {"1" },
8388 },
8489 args : args {
8590 ctx : context .TODO (),
@@ -93,7 +98,8 @@ func TestExecCommand_Run(t *testing.T) {
9398 params : & chaos.GlobalParams {
9499 Names : []string {"c1" , "c2" , "c3" },
95100 },
96- command : "kill 1" ,
101+ command : "kill" ,
102+ args : []string {"1" },
97103 },
98104 args : args {
99105 ctx : context .TODO (),
@@ -105,7 +111,8 @@ func TestExecCommand_Run(t *testing.T) {
105111 params : & chaos.GlobalParams {
106112 Names : []string {"c1" , "c2" , "c3" },
107113 },
108- command : "kill 1" ,
114+ command : "kill" ,
115+ args : []string {"1" },
109116 },
110117 args : args {
111118 ctx : context .TODO (),
@@ -119,7 +126,8 @@ func TestExecCommand_Run(t *testing.T) {
119126 params : & chaos.GlobalParams {
120127 Names : []string {"c1" , "c2" , "c3" },
121128 },
122- command : "kill 1" ,
129+ command : "kill" ,
130+ args : []string {"1" },
123131 },
124132 args : args {
125133 ctx : context .TODO (),
@@ -138,6 +146,7 @@ func TestExecCommand_Run(t *testing.T) {
138146 pattern : tt .fields .params .Pattern ,
139147 labels : tt .fields .params .Labels ,
140148 command : tt .fields .command ,
149+ args : tt .fields .args ,
141150 limit : tt .fields .limit ,
142151 dryRun : tt .fields .params .DryRun ,
143152 }
@@ -153,11 +162,11 @@ func TestExecCommand_Run(t *testing.T) {
153162 }
154163 }
155164 if tt .args .random {
156- mockClient .On ("ExecContainer" , tt .args .ctx , mock .AnythingOfType ("*container.Container" ), tt .fields .command , tt .fields .params .DryRun ).Return (nil )
165+ mockClient .On ("ExecContainer" , tt .args .ctx , mock .AnythingOfType ("*container.Container" ), tt .fields .command , tt .fields .args , tt . fields . params .DryRun ).Return (nil )
157166 } else {
158167 for i := range tt .expected {
159168 if tt .fields .limit == 0 || i < tt .fields .limit {
160- call = mockClient .On ("ExecContainer" , tt .args .ctx , mock .AnythingOfType ("*container.Container" ), tt .fields .command , tt .fields .params .DryRun )
169+ call = mockClient .On ("ExecContainer" , tt .args .ctx , mock .AnythingOfType ("*container.Container" ), tt .fields .command , tt .fields .args , tt . fields . params .DryRun )
161170 if tt .errs .execError {
162171 call .Return (errors .New ("ERROR" ))
163172 goto Invoke
0 commit comments