-
Notifications
You must be signed in to change notification settings - Fork 288
/
test_state.go
41 lines (34 loc) · 904 Bytes
/
test_state.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
package docker
import (
"time"
"github.com/docker/docker/api/types"
)
// Helper functions for generating container states.
func NewCreatedContainerState() types.ContainerState {
return types.ContainerState{
Status: "created",
StartedAt: ZeroTime,
FinishedAt: ZeroTime,
}
}
func NewRunningContainerState() types.ContainerState {
return types.ContainerState{
Running: true,
StartedAt: time.Now().Format(time.RFC3339Nano),
FinishedAt: ZeroTime,
}
}
func NewExitSuccessContainerState() types.ContainerState {
return types.ContainerState{
StartedAt: time.Now().Format(time.RFC3339Nano),
FinishedAt: time.Now().Format(time.RFC3339Nano),
ExitCode: 0,
}
}
func NewExitErrorContainerState() types.ContainerState {
return types.ContainerState{
StartedAt: time.Now().Format(time.RFC3339Nano),
FinishedAt: time.Now().Format(time.RFC3339Nano),
ExitCode: 1,
}
}