mirror of
https://github.com/actions/actions-runner-controller.git
synced 2026-01-01 23:23:41 +08:00
Allow update runner group for AutoScalingRunnerSet (#2216)
This commit is contained in:
@@ -36,6 +36,18 @@ var defaultRunnerScaleSet = &actions.RunnerScaleSet{
|
||||
Statistics: nil,
|
||||
}
|
||||
|
||||
var defaultUpdatedRunnerScaleSet = &actions.RunnerScaleSet{
|
||||
Id: 1,
|
||||
Name: "testset",
|
||||
RunnerGroupId: 2,
|
||||
RunnerGroupName: "testgroup",
|
||||
Labels: []actions.Label{{Type: "test", Name: "test"}},
|
||||
RunnerSetting: actions.RunnerSetting{},
|
||||
CreatedOn: time.Now(),
|
||||
RunnerJitConfigUrl: "test.test.test",
|
||||
Statistics: nil,
|
||||
}
|
||||
|
||||
var defaultRunnerGroup = &actions.RunnerGroup{
|
||||
ID: 1,
|
||||
Name: "testgroup",
|
||||
@@ -107,6 +119,10 @@ type FakeClient struct {
|
||||
*actions.RunnerScaleSet
|
||||
err error
|
||||
}
|
||||
updateRunnerScaleSetResult struct {
|
||||
*actions.RunnerScaleSet
|
||||
err error
|
||||
}
|
||||
createMessageSessionResult struct {
|
||||
*actions.RunnerScaleSetSession
|
||||
err error
|
||||
@@ -164,6 +180,7 @@ func (f *FakeClient) applyDefaults() {
|
||||
f.getRunnerScaleSetByIdResult.RunnerScaleSet = defaultRunnerScaleSet
|
||||
f.getRunnerGroupByNameResult.RunnerGroup = defaultRunnerGroup
|
||||
f.createRunnerScaleSetResult.RunnerScaleSet = defaultRunnerScaleSet
|
||||
f.updateRunnerScaleSetResult.RunnerScaleSet = defaultUpdatedRunnerScaleSet
|
||||
f.createMessageSessionResult.RunnerScaleSetSession = defaultRunnerScaleSetSession
|
||||
f.refreshMessageSessionResult.RunnerScaleSetSession = defaultRunnerScaleSetSession
|
||||
f.acquireJobsResult.ids = []int64{1}
|
||||
@@ -190,6 +207,10 @@ func (f *FakeClient) CreateRunnerScaleSet(ctx context.Context, runnerScaleSet *a
|
||||
return f.createRunnerScaleSetResult.RunnerScaleSet, f.createRunnerScaleSetResult.err
|
||||
}
|
||||
|
||||
func (f *FakeClient) UpdateRunnerScaleSet(ctx context.Context, runnerScaleSetId int, runnerScaleSet *actions.RunnerScaleSet) (*actions.RunnerScaleSet, error) {
|
||||
return f.updateRunnerScaleSetResult.RunnerScaleSet, f.updateRunnerScaleSetResult.err
|
||||
}
|
||||
|
||||
func (f *FakeClient) CreateMessageSession(ctx context.Context, runnerScaleSetId int, owner string) (*actions.RunnerScaleSetSession, error) {
|
||||
return f.createMessageSessionResult.RunnerScaleSetSession, f.createMessageSessionResult.err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user