From a40c5b551d59c979b344a076c309dd100b94f6b1 Mon Sep 17 00:00:00 2001 From: Justin Alvarez Date: Wed, 3 Jan 2024 19:30:31 -0500 Subject: [PATCH] fix linting after merge Signed-off-by: Justin Alvarez --- cmd/finch/nerdctl_windows_test.go | 19 ++++++++++++++----- pkg/disk/disk.go | 2 -- pkg/disk/disk_unix.go | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cmd/finch/nerdctl_windows_test.go b/cmd/finch/nerdctl_windows_test.go index af1733ea9..47b40fd4a 100644 --- a/cmd/finch/nerdctl_windows_test.go +++ b/cmd/finch/nerdctl_windows_test.go @@ -19,6 +19,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/runfinch/finch/pkg/config" "github.com/runfinch/finch/pkg/flog" "github.com/runfinch/finch/pkg/mocks" ) @@ -77,7 +78,7 @@ func TestNerdctlCommand_runAdaptor(t *testing.T) { logger := mocks.NewLogger(ctrl) tc.mockSvc(ecc, lcc, logger, ctrl, ncsd) - assert.NoError(t, newNerdctlCommand(ecc, lcc, ncsd, logger, nil).runAdapter(tc.cmd, tc.args)) + assert.NoError(t, newNerdctlCommand(lcc, ecc, ncsd, logger, nil, &config.Finch{}).runAdapter(tc.cmd, tc.args)) }) } } @@ -88,6 +89,7 @@ func TestNerdctlCommand_run(t *testing.T) { testCases := []struct { name string cmdName string + fc *config.Finch args []string wantErr error mockSvc func(*testing.T, *mocks.CommandCreator, *mocks.LimaCmdCreator, *mocks.Command, *mocks.NerdctlCommandSystemDeps, @@ -476,6 +478,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with --add-host flag but without using special IP by equal", cmdName: "run", + fc: &config.Finch{}, args: []string{"--rm", "--add-host=name:0.0.0.0", "alpine:latest"}, wantErr: nil, mockSvc: func( @@ -509,6 +512,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with multiple nested volumes", cmdName: "run", + fc: &config.Finch{}, args: []string{ "--rm", "-v", "C:\\workdir:/tmp1/tmp2:rro", "-v=C:\\workdir:/tmp1/tmp2/tmp3/tmp4:rro", "-v", "volume", "alpine:latest", @@ -546,6 +550,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with --help flag", cmdName: "pull", + fc: &config.Finch{}, args: []string{"test:tag", "--help"}, wantErr: nil, mockSvc: func( @@ -578,6 +583,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with --help flag but replacing returns error", cmdName: "pull", + fc: &config.Finch{}, args: []string{"test:tag", "--help"}, wantErr: fmt.Errorf("failed to replace"), mockSvc: func( @@ -610,6 +616,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with COSIGN_PASSWORD env var and --sign=cosign", cmdName: "push", + fc: &config.Finch{}, args: []string{"--sign=cosign", "test:tag"}, wantErr: nil, mockSvc: func( @@ -643,6 +650,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with COSIGN_PASSWORD env var and --verify=cosign", cmdName: "pull", + fc: &config.Finch{}, args: []string{"--verify=cosign", "test:tag"}, wantErr: nil, mockSvc: func( @@ -676,6 +684,7 @@ func TestNerdctlCommand_run(t *testing.T) { { name: "with COSIGN_PASSWORD env var without cosign arg", cmdName: "pull", + fc: &config.Finch{}, args: []string{"test:tag"}, wantErr: nil, mockSvc: func( @@ -721,7 +730,7 @@ func TestNerdctlCommand_run(t *testing.T) { logger := mocks.NewLogger(ctrl) fs := afero.NewMemMapFs() tc.mockSvc(t, ecc, lcc, cmd, ncsd, logger, ctrl, fs) - assert.Equal(t, tc.wantErr, newNerdctlCommand(ecc, lcc, ncsd, logger, fs).run(tc.cmdName, tc.args)) + assert.Equal(t, tc.wantErr, newNerdctlCommand(lcc, ecc, ncsd, logger, fs, tc.fc).run(tc.cmdName, tc.args)) }) } } @@ -943,7 +952,7 @@ func TestNerdctlCommand_Run_withBindMounts(t *testing.T) { logger := mocks.NewLogger(ctrl) fs := afero.NewMemMapFs() tc.mockSvc(t, ecc, lcc, ncsd, logger, ctrl, fs) - assert.Equal(t, tc.wantErr, newNerdctlCommand(ecc, lcc, ncsd, logger, fs).run(tc.cmdName, tc.args)) + assert.Equal(t, tc.wantErr, newNerdctlCommand(lcc, ecc, ncsd, logger, fs, &config.Finch{}).run(tc.cmdName, tc.args)) }) } } @@ -1062,7 +1071,7 @@ func TestNerdctlCommand_run_CpCommand(t *testing.T) { logger := mocks.NewLogger(ctrl) tc.mockSvc(ecc, lcc, logger, ctrl, ncsd) - assert.NoError(t, newNerdctlCommand(ecc, lcc, ncsd, logger, nil).run(tc.cmdName, tc.args)) + assert.NoError(t, newNerdctlCommand(lcc, ecc, ncsd, logger, nil, &config.Finch{}).run(tc.cmdName, tc.args)) }) } } @@ -1188,7 +1197,7 @@ func TestNerdctlCommand_run_BuildCommand(t *testing.T) { logger := mocks.NewLogger(ctrl) tc.mockSvc(ecc, lcc, logger, ctrl, ncsd) - assert.NoError(t, newNerdctlCommand(ecc, lcc, ncsd, logger, nil).run(tc.cmdName, tc.args)) + assert.NoError(t, newNerdctlCommand(lcc, ecc, ncsd, logger, nil, &config.Finch{}).run(tc.cmdName, tc.args)) }) } } diff --git a/pkg/disk/disk.go b/pkg/disk/disk.go index c69fd784e..cb4975668 100644 --- a/pkg/disk/disk.go +++ b/pkg/disk/disk.go @@ -15,8 +15,6 @@ import ( fpath "github.com/runfinch/finch/pkg/path" ) -const diskSizeStr = "50GB" - // UserDataDiskManager is used to check the user data disk configuration and create it if needed. type UserDataDiskManager interface { EnsureUserDataDisk() error diff --git a/pkg/disk/disk_unix.go b/pkg/disk/disk_unix.go index 01d107ae2..dd36ae036 100644 --- a/pkg/disk/disk_unix.go +++ b/pkg/disk/disk_unix.go @@ -19,7 +19,8 @@ import ( const ( // diskName must always be consistent with the value set for AdditionalDisks in lima_config_applier.go. - diskName = "finch" + diskName = "finch" + diskSizeStr = "50GB" ) type qemuDiskInfo struct {