Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-and-test-msi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Expand Down Expand Up @@ -152,6 +153,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Expand Down Expand Up @@ -206,6 +208,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Expand Down Expand Up @@ -252,6 +255,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
Start-Sleep -s 10
wsl --unregister lima-finch
Expand Down Expand Up @@ -288,6 +292,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Expand Down Expand Up @@ -97,6 +98,7 @@ jobs:
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
sc query LxssManager | findstr "STATE" | findstr /C:"STOPPED" > nul && net start LxssManager
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Expand Down
30 changes: 30 additions & 0 deletions cmd/finch/nerdctl_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,36 @@ func TestNerdctlCommand_run(t *testing.T) {
c.EXPECT().Run()
},
},
{
name: "with long-form boolean flags",
cmdName: "run",
fc: &config.Finch{},
args: []string{
"-e", "ARG1=val1", "-p", "8080:8080",
"--name", "myContainer", "--interactive=true", "--detach", "--rm=true", "--init=false", "--privileged=false", "alpine:latest", "env",
},
wantErr: nil,
mockSvc: func(
_ *testing.T,
lcc *mocks.NerdctlCmdCreator,
_ *mocks.CommandCreator,
ncsd *mocks.NerdctlCommandSystemDeps,
logger *mocks.Logger,
ctrl *gomock.Controller,
_ afero.Fs,
) {
getVMStatusC := mocks.NewCommand(ctrl)
lcc.EXPECT().CreateWithoutStdio("ls", "-f", "{{.Status}}", limaInstanceName).Return(getVMStatusC)
getVMStatusC.EXPECT().Output().Return([]byte("Running"), nil)
logger.EXPECT().Debugf("Status of virtual machine: %s", "Running")
AddEmptyEnvLookUps(ncsd)
c := mocks.NewCommand(ctrl)
lcc.EXPECT().Create("shell", limaInstanceName, "sudo", "-E", nerdctlCmdName, "container", "run",
"-p", "8080:8080", "--name", "myContainer", "--interactive=true", "--detach", "--rm=true", "--init=false", "--privileged=false", "-e", "ARG1=val1",
"alpine:latest", "env").Return(c)
c.EXPECT().Run()
},
},
}

for _, tc := range testCases {
Expand Down
31 changes: 31 additions & 0 deletions cmd/finch/nerdctl_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,37 @@ func TestNerdctlCommand_run(t *testing.T) {
c.EXPECT().Run()
},
},
{
name: "with long-form boolean flags",
cmdName: "run",
fc: &config.Finch{},
args: []string{"--rm", "--add-host", "name:0.0.0.0", "--interactive=true", "--detach", "--rm=true", "--init=false", "--privileged=false", "alpine:latest"},
wantErr: nil,
mockSvc: func(
_ *testing.T,
_ *mocks.CommandCreator,
ncc *mocks.NerdctlCmdCreator,
_ *mocks.Command,
ncsd *mocks.NerdctlCommandSystemDeps,
logger *mocks.Logger,
ctrl *gomock.Controller,
_ afero.Fs,
) {
getVMStatusC := mocks.NewCommand(ctrl)
ncc.EXPECT().CreateWithoutStdio("ls", "-f", "{{.Status}}", limaInstanceName).Return(getVMStatusC)
getVMStatusC.EXPECT().Output().Return([]byte("Running"), nil)
logger.EXPECT().Debugf("Status of virtual machine: %s", "Running")
AddEmptyEnvLookUps(ncsd)
ncsd.EXPECT().GetWd().Return("C:\\workdir", nil)
ncsd.EXPECT().FilePathAbs("C:\\workdir").Return("C:\\workdir", nil)
ncsd.EXPECT().FilePathJoin(string(filepath.Separator), "mnt", "c", "workdir").Return(augmentedPath)
ncsd.EXPECT().FilePathToSlash(augmentedPath).Return(wslPath)
c := mocks.NewCommand(ctrl)
ncc.EXPECT().Create("shell", "--workdir", wslPath, limaInstanceName, "sudo", "-E", nerdctlCmdName, "container", "run",
"--interactive=true", "--detach", "--privileged=false", "--add-host", "name:0.0.0.0", "--rm=true", "--init=false", "alpine:latest").Return(c)
c.EXPECT().Run()
},
},
}

for _, tc := range testCases {
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ require (
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
k8s.io/klog/v2 v2.130.1 // indirect
)

replace github.com/runfinch/common-tests => /home/arjunry/codestation/common-tests
Loading