Skip to content

Commit 11c0459

Browse files
author
Ma Shimiao
authored
Merge pull request opencontainers#504 from q384566678/fix-validate-test
validate_test: add cwd check to TestCheckProcess
2 parents dea65b0 + 630f06a commit 11c0459

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

validate/validate_test.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,49 @@ func TestCheckProcess(t *testing.T) {
206206
platform: "linux",
207207
expected: specerror.NonError,
208208
},
209+
{
210+
val: rspec.Spec{
211+
Version: "1.0.0",
212+
Process: &rspec.Process{
213+
Args: []string{"sh"},
214+
Cwd: "/",
215+
},
216+
},
217+
platform: "windows",
218+
expected: specerror.ProcCwdAbs,
219+
},
220+
{
221+
val: rspec.Spec{
222+
Version: "1.0.0",
223+
Process: &rspec.Process{
224+
Args: []string{"sh"},
225+
Cwd: "c:\\foo",
226+
},
227+
},
228+
platform: "linux",
229+
expected: specerror.ProcCwdAbs,
230+
},
231+
{
232+
val: rspec.Spec{
233+
Version: "1.0.0",
234+
Process: &rspec.Process{
235+
Args: []string{"sh"},
236+
Cwd: "c:\\foo",
237+
},
238+
},
239+
platform: "windows",
240+
expected: specerror.NonError,
241+
},
242+
{
243+
val: rspec.Spec{
244+
Version: "1.0.0",
245+
Process: &rspec.Process{
246+
Cwd: "/",
247+
},
248+
},
249+
platform: "linux",
250+
expected: specerror.ProcArgsOneEntryRequired,
251+
},
209252
{
210253
val: rspec.Spec{
211254
Version: "1.0.0",

0 commit comments

Comments
 (0)