diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-20 23:07:42 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-11-09 15:38:42 +0100 |
commit | 714c83b2736d7e308bc33c49057952490eb98be2 (patch) | |
tree | 1d9ba7035798368569cd49056f4d596efc908cd8 /pkg/runner/container_mock_test.go | |
parent | Initial commit. (diff) | |
download | forgejo-act-714c83b2736d7e308bc33c49057952490eb98be2.tar.xz forgejo-act-714c83b2736d7e308bc33c49057952490eb98be2.zip |
Adding upstream version 1.21.4.HEADupstream/1.21.4upstreamdebian
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'pkg/runner/container_mock_test.go')
-rw-r--r-- | pkg/runner/container_mock_test.go | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/pkg/runner/container_mock_test.go b/pkg/runner/container_mock_test.go new file mode 100644 index 0000000..04d6261 --- /dev/null +++ b/pkg/runner/container_mock_test.go @@ -0,0 +1,75 @@ +package runner + +import ( + "context" + "io" + + "github.com/nektos/act/pkg/common" + "github.com/nektos/act/pkg/container" + "github.com/stretchr/testify/mock" +) + +type containerMock struct { + mock.Mock + container.Container + container.LinuxContainerEnvironmentExtensions +} + +func (cm *containerMock) Create(capAdd []string, capDrop []string) common.Executor { + args := cm.Called(capAdd, capDrop) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) Pull(forcePull bool) common.Executor { + args := cm.Called(forcePull) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) Start(attach bool) common.Executor { + args := cm.Called(attach) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) Remove() common.Executor { + args := cm.Called() + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) Close() common.Executor { + args := cm.Called() + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor { + args := cm.Called(srcPath, env) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) UpdateFromImageEnv(env *map[string]string) common.Executor { + args := cm.Called(env) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) Copy(destPath string, files ...*container.FileEntry) common.Executor { + args := cm.Called(destPath, files) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) CopyDir(destPath string, srcPath string, useGitIgnore bool) common.Executor { + args := cm.Called(destPath, srcPath, useGitIgnore) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) Exec(command []string, env map[string]string, user, workdir string) common.Executor { + args := cm.Called(command, env, user, workdir) + return args.Get(0).(func(context.Context) error) +} + +func (cm *containerMock) GetContainerArchive(ctx context.Context, srcPath string) (io.ReadCloser, error) { + args := cm.Called(ctx, srcPath) + err, hasErr := args.Get(1).(error) + if !hasErr { + err = nil + } + return args.Get(0).(io.ReadCloser), err +} |