Skip to content

Commit 79ae4aa

Browse files
committed
validation: run CLI with correct argument order
The OCI Runtime Command Line Interface [1][1] specifies the order of the arguments: ``` $ funC [global-options] <COMMAND> [command-specific-options] <command-specific-arguments> ``` runc [2][2] is flexible whether command-specific-options is before or after command-specific-arguments. But crun [3][3] is not, making the tests fail. Since the CLI spec only specifies one order, the validation tests should respect that order. [1]: https://github.com/opencontainers/runtime-tools/blob/master/docs/command-line-interface.md#global-usage [2]: https://github.com/opencontainers/runc [3]: https://github.com/giuseppe/crun Signed-off-by: Alban Crequy <[email protected]>
1 parent fdbc3d6 commit 79ae4aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

validation/util/container.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ func (r *Runtime) SetID(id string) {
6969
func (r *Runtime) Create() (err error) {
7070
var args []string
7171
args = append(args, "create")
72-
if r.ID != "" {
73-
args = append(args, r.ID)
74-
}
7572
if r.PidFile != "" {
7673
args = append(args, "--pid-file", r.PidFile)
7774
}
7875
if r.BundleDir != "" {
7976
args = append(args, "--bundle", r.BundleDir)
8077
}
78+
if r.ID != "" {
79+
args = append(args, r.ID)
80+
}
8181
cmd := exec.Command(r.RuntimeCommand, args...)
8282
id := uuid.NewV4().String()
8383
r.stdout, err = os.OpenFile(filepath.Join(r.bundleDir(), fmt.Sprintf("stdout-%s", id)), os.O_CREATE|os.O_EXCL|os.O_RDWR, 0600)

0 commit comments

Comments
 (0)