Fix docker input unit tests

This commit is contained in:
Daniel Nelson 2019-06-21 14:45:56 -07:00
parent 791d154ec1
commit f405bca034
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
1 changed files with 32 additions and 53 deletions

View File

@ -543,6 +543,7 @@ func TestContainerStatus(t *testing.T) {
// tags
Status string
// fields
ContainerID string
OOMKilled bool
Pid int
ExitCode int
@ -564,6 +565,7 @@ func TestContainerStatus(t *testing.T) {
},
inspect: containerInspect(),
expect: expectation{
ContainerID: "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
Status: "running",
OOMKilled: false,
Pid: 1234,
@ -580,6 +582,7 @@ func TestContainerStatus(t *testing.T) {
return i
}(),
expect: expectation{
ContainerID: "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
Status: "running",
OOMKilled: false,
Pid: 1234,
@ -598,6 +601,7 @@ func TestContainerStatus(t *testing.T) {
return i
}(),
expect: expectation{
ContainerID: "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
Status: "running",
OOMKilled: false,
Pid: 1234,
@ -639,6 +643,7 @@ func TestContainerStatus(t *testing.T) {
"oomkilled": tt.expect.OOMKilled,
"pid": tt.expect.Pid,
"exitcode": tt.expect.ExitCode,
"container_id": tt.expect.ContainerID,
}
if started := tt.expect.StartedAt; !started.IsZero() {
@ -756,32 +761,6 @@ func TestDockerGatherInfo(t *testing.T) {
"container_status": "running",
},
)
acc.AssertContainsTaggedFields(t,
"docker_container_status",
map[string]interface{}{
"container_id": "b7dfbb9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296e2173",
"exitcode": int(0),
"oomkilled": false,
"pid": int(1234),
"started_at": int64(1528955333266176036),
//"finished_at": float64(0),
},
map[string]string{
"engine_host": "absol",
"container_name": "etcd2",
"container_image": "quay.io:4443/coreos/etcd",
"container_version": "v2.2.2",
"ENVVAR1": "loremipsum",
"ENVVAR2": "dolorsitamet",
"ENVVAR3": "=ubuntu:10.04",
"ENVVAR7": "ENVVAR8=ENVVAR9",
"label1": "test_value_1",
"label2": "test_value_2",
"server_version": "17.09.0-ce",
"container_status": "running",
},
)
}
func TestDockerGatherSwarmInfo(t *testing.T) {