-
Notifications
You must be signed in to change notification settings - Fork 4
/
export_test.go
37 lines (30 loc) · 968 Bytes
/
export_test.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
37
package distro
import (
"context"
"github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/distros/initialTasks"
)
func WithTaskProcessingContext(ctx context.Context) Option {
return func(o *options) {
if ctx != nil {
o.taskProcessingContext = ctx
}
}
}
// WithNewWorker is an optional parameter for distro.New that allows for overriding
// the worker.New constructor. It is meant for dependency injection.
func WithNewWorker(newWorkerFunc func(context.Context, *Distro, string, *initialTasks.InitialTasks) (workerInterface, error)) Option {
return func(o *options) {
o.newWorkerFunc = newWorkerFunc
}
}
type Worker = workerInterface
// Identity contains persistent and uniquely identifying information about the distro.
type Identity = identity
// GetIdentity returns a reference to the distro's identity.
//
// False positive, Identity is exported.
//
//nolint:revive
func (d *Distro) GetIdentity() *Identity {
return &d.identity
}