forked from carlosa8c/acyl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake.go
36 lines (29 loc) · 1.06 KB
/
fake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package meta
import (
"context"
"github.com/dollarshaveclub/acyl/pkg/models"
)
type FakeGetter struct {
GetFunc func(ctx context.Context, rd models.RepoRevisionData) (*models.RepoConfig, error)
FetchChartsFunc func(ctx context.Context, rc *models.RepoConfig, basePath string) (ChartLocations, error)
GetAcylYAMLFunc func(ctx context.Context, rc *models.RepoConfig, repo, ref string) (err error)
}
var _ Getter = &FakeGetter{}
func (fg *FakeGetter) Get(ctx context.Context, rd models.RepoRevisionData) (*models.RepoConfig, error) {
if fg.GetFunc != nil {
return fg.GetFunc(ctx, rd)
}
return &models.RepoConfig{}, nil
}
func (fg *FakeGetter) FetchCharts(ctx context.Context, rc *models.RepoConfig, basePath string) (ChartLocations, error) {
if fg.FetchChartsFunc != nil {
return fg.FetchChartsFunc(ctx, rc, basePath)
}
return ChartLocations{}, nil
}
func (fg *FakeGetter) GetAcylYAML(ctx context.Context, rc *models.RepoConfig, repo, ref string) (err error) {
if fg.GetAcylYAMLFunc != nil {
return fg.GetAcylYAMLFunc(ctx, rc, repo, ref)
}
return nil
}