mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-06 17:40:58 +00:00
It will be imported by Forgejo. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/777): <!--number 777 --><!--line 0 --><!--description Y2hvcmU6IHRvIGFsbG93IHRoZSBydW5uZXIgdG8gYmUgaW1wb3J0ZWQsIHY5IG5lZWRzIHRvIGJlIGluIHRoZSBnbyBtb2R1bGU=-->chore: to allow the runner to be imported, v9 needs to be in the go module<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/777 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
75 lines
2.1 KiB
Go
75 lines
2.1 KiB
Go
package runner
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"code.forgejo.org/forgejo/runner/v9/act/common"
|
|
"code.forgejo.org/forgejo/runner/v9/act/container"
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
type containerMock struct {
|
|
mock.Mock
|
|
container.Container
|
|
container.LinuxContainerEnvironmentExtensions
|
|
}
|
|
|
|
func (cm *containerMock) Create(capAdd, 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, 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
|
|
}
|