@@ -1171,6 +1171,36 @@ func TestNerdctlCommand_run(t *testing.T) {
1171
1171
c .EXPECT ().Run ()
1172
1172
},
1173
1173
},
1174
+ {
1175
+ name : "with long-form boolean flags" ,
1176
+ cmdName : "run" ,
1177
+ fc : & config.Finch {},
1178
+ args : []string {
1179
+ "-e" , "ARG1=val1" , "-p" , "8080:8080" ,
1180
+ "--name" , "myContainer" , "--interactive=true" , "--detach" , "--rm=true" , "--init=false" , "--privileged=false" , "alpine:latest" , "env" ,
1181
+ },
1182
+ wantErr : nil ,
1183
+ mockSvc : func (
1184
+ _ * testing.T ,
1185
+ lcc * mocks.NerdctlCmdCreator ,
1186
+ _ * mocks.CommandCreator ,
1187
+ ncsd * mocks.NerdctlCommandSystemDeps ,
1188
+ logger * mocks.Logger ,
1189
+ ctrl * gomock.Controller ,
1190
+ _ afero.Fs ,
1191
+ ) {
1192
+ getVMStatusC := mocks .NewCommand (ctrl )
1193
+ lcc .EXPECT ().CreateWithoutStdio ("ls" , "-f" , "{{.Status}}" , limaInstanceName ).Return (getVMStatusC )
1194
+ getVMStatusC .EXPECT ().Output ().Return ([]byte ("Running" ), nil )
1195
+ logger .EXPECT ().Debugf ("Status of virtual machine: %s" , "Running" )
1196
+ AddEmptyEnvLookUps (ncsd )
1197
+ c := mocks .NewCommand (ctrl )
1198
+ lcc .EXPECT ().Create ("shell" , limaInstanceName , "sudo" , "-E" , nerdctlCmdName , "container" , "run" ,
1199
+ "--interactive=true" , "--detach" , "--privileged=false" , "-p" , "8080:8080" , "--name" , "myContainer" , "--rm=true" , "--init=false" , "-e" , "ARG1=val1" ,
1200
+ "alpine:latest" , "env" ).Return (c )
1201
+ c .EXPECT ().Run ()
1202
+ },
1203
+ },
1174
1204
}
1175
1205
1176
1206
for _ , tc := range testCases {
0 commit comments