mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-10-18 06:31:32 +02:00
Introduce new preview auto-scaling mode for ARC. (#2153)
Co-authored-by: Cory Miller <cory-miller@github.com> Co-authored-by: Nikola Jokic <nikola-jokic@github.com> Co-authored-by: Ava Stancu <AvaStancu@github.com> Co-authored-by: Ferenc Hammerl <fhammerl@github.com> Co-authored-by: Francesco Renzi <rentziass@github.com> Co-authored-by: Bassem Dghaidi <Link-@github.com>
This commit is contained in:
co-authored by
Cory Miller
Nikola Jokic
Ava Stancu
Ferenc Hammerl
Francesco Renzi
Bassem Dghaidi
parent
619667fc3b
commit
622eaa34f8
@@ -0,0 +1,43 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/actions/actions-runner-controller/github/actions"
|
||||
)
|
||||
|
||||
type MultiClientOption func(*fakeMultiClient)
|
||||
|
||||
func WithDefaultClient(client actions.ActionsService, err error) MultiClientOption {
|
||||
return func(f *fakeMultiClient) {
|
||||
f.defaultClient = client
|
||||
f.defaultErr = err
|
||||
}
|
||||
}
|
||||
|
||||
type fakeMultiClient struct {
|
||||
defaultClient actions.ActionsService
|
||||
defaultErr error
|
||||
}
|
||||
|
||||
func NewMultiClient(opts ...MultiClientOption) actions.MultiClient {
|
||||
f := &fakeMultiClient{}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(f)
|
||||
}
|
||||
|
||||
if f.defaultClient == nil {
|
||||
f.defaultClient = NewFakeClient()
|
||||
}
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func (f *fakeMultiClient) GetClientFor(ctx context.Context, githubConfigURL string, creds actions.ActionsAuth, namespace string) (actions.ActionsService, error) {
|
||||
return f.defaultClient, f.defaultErr
|
||||
}
|
||||
|
||||
func (f *fakeMultiClient) GetClientFromSecret(ctx context.Context, githubConfigURL, namespace string, secretData actions.KubernetesSecretData) (actions.ActionsService, error) {
|
||||
return f.defaultClient, f.defaultErr
|
||||
}
|
||||
Reference in New Issue
Block a user