Monitor-only for individual containers (#652)

* Add monitor-only label

* Add tests for monitor-only

* Treat missing monitor-only label as if the option was set to false

* Add docs for container-based monitor-only

* Add function doc

* Fix monitor-only logic
This commit is contained in:
David H 2020-10-03 22:00:02 +02:00 committed by GitHub
parent 98b518612b
commit bde421be0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 147 additions and 10 deletions

View file

@ -27,3 +27,22 @@ func CreateMockContainer(id string, name string, image string, created time.Time
},
)
}
// CreateMockContainerWithConfig creates a container substitute valid for testing
func CreateMockContainerWithConfig(id string, name string, image string, created time.Time, config *container2.Config) container.Container {
content := types.ContainerJSON{
ContainerJSONBase: &types.ContainerJSONBase{
ID: id,
Image: image,
Name: name,
Created: created.String(),
},
Config: config,
}
return *container.NewContainer(
&content,
&types.ImageInspect{
ID: image,
},
)
}