-
Notifications
You must be signed in to change notification settings - Fork 303
/
fake.go
34 lines (27 loc) · 869 Bytes
/
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
package tiltfile
import (
"context"
"github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1"
"github.com/tilt-dev/tilt/pkg/model"
)
type FakeTiltfileLoader struct {
Result TiltfileLoadResult
userConfigState model.UserConfigState
Delegate TiltfileLoader
}
var _ TiltfileLoader = &FakeTiltfileLoader{}
func NewFakeTiltfileLoader() *FakeTiltfileLoader {
return &FakeTiltfileLoader{}
}
func (tfl *FakeTiltfileLoader) Load(ctx context.Context, tf *v1alpha1.Tiltfile) TiltfileLoadResult {
userConfigState := model.NewUserConfigState(tf.Spec.Args)
tfl.userConfigState = userConfigState
if tfl.Delegate != nil {
return tfl.Delegate.Load(ctx, tf)
}
return tfl.Result
}
// the UserConfigState that was passed to the last invocation of Load
func (tfl *FakeTiltfileLoader) PassedUserConfigState() model.UserConfigState {
return tfl.userConfigState
}