-
Notifications
You must be signed in to change notification settings - Fork 8
/
types.go
62 lines (47 loc) · 1.18 KB
/
types.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package types
import (
"context"
)
type Environment interface {
// Test executes a feature(set) against the environment.
Test(context.Context, Feature) error
}
type StepConfig struct {
// the command that the step should run
Command string
// the working directory where the step should run
WorkingDir string
}
type Harness interface {
// Setup returns the Step that creates the harness and signals the caller is
// using the harness.
Setup() StepFn
// Finish returns the StepFn that signals the caller is done with the
// harness.
Finish() StepFn
// Destroy destroys the harness.
Destroy(context.Context) error
// Done blocks until all callers of the harness are done with it.
Done() error
// StepFn returns a StepFn that executes the given command in the harness.
StepFn(config StepConfig) StepFn
// DebugLogCommand outputs the error logs coming from the harness.
DebugLogCommand() string
}
type Feature interface {
Name() string
Labels() map[string]string
Steps() []Step
}
type Level uint8
const (
Before Level = iota
Assessment
After
)
type StepFn func(ctx context.Context) (context.Context, error)
type Step interface {
Name() string
Fn() StepFn
Level() Level
}