mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 14:10:12 +01:00
Session report collection and report templates (#981)
* wip: notification stats * make report notifications optional * linting/documentation fixes * linting/documentation fixes * merge types.Container and container.Interface * smaller naming/format fixes * use typed image/container IDs * simplify notifier and update tests * add missed doc comments * lint fixes * remove unused constructors * rename old/new current/latest
This commit is contained in:
parent
d0ecc23d72
commit
e3dd8d688a
32 changed files with 853 additions and 598 deletions
|
|
@ -41,12 +41,12 @@ func CreateMockClient(data *TestData, api cli.CommonAPIClient, pullImages bool,
|
|||
}
|
||||
|
||||
// ListContainers is a mock method returning the provided container testdata
|
||||
func (client MockClient) ListContainers(f t.Filter) ([]container.Container, error) {
|
||||
func (client MockClient) ListContainers(_ t.Filter) ([]container.Container, error) {
|
||||
return client.TestData.Containers, nil
|
||||
}
|
||||
|
||||
// StopContainer is a mock method
|
||||
func (client MockClient) StopContainer(c container.Container, d time.Duration) error {
|
||||
func (client MockClient) StopContainer(c container.Container, _ time.Duration) error {
|
||||
if c.Name() == client.TestData.NameOfContainerToKeep {
|
||||
return errors.New("tried to stop the instance we want to keep")
|
||||
}
|
||||
|
|
@ -54,28 +54,28 @@ func (client MockClient) StopContainer(c container.Container, d time.Duration) e
|
|||
}
|
||||
|
||||
// StartContainer is a mock method
|
||||
func (client MockClient) StartContainer(c container.Container) (string, error) {
|
||||
func (client MockClient) StartContainer(_ container.Container) (t.ContainerID, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// RenameContainer is a mock method
|
||||
func (client MockClient) RenameContainer(c container.Container, s string) error {
|
||||
func (client MockClient) RenameContainer(_ container.Container, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveImageByID increments the TriedToRemoveImageCount on being called
|
||||
func (client MockClient) RemoveImageByID(id string) error {
|
||||
func (client MockClient) RemoveImageByID(_ t.ImageID) error {
|
||||
client.TestData.TriedToRemoveImageCount++
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetContainer is a mock method
|
||||
func (client MockClient) GetContainer(containerID string) (container.Container, error) {
|
||||
func (client MockClient) GetContainer(_ t.ContainerID) (container.Container, error) {
|
||||
return client.TestData.Containers[0], nil
|
||||
}
|
||||
|
||||
// ExecuteCommand is a mock method
|
||||
func (client MockClient) ExecuteCommand(containerID string, command string, timeout int) (SkipUpdate bool, err error) {
|
||||
func (client MockClient) ExecuteCommand(_ t.ContainerID, command string, _ int) (SkipUpdate bool, err error) {
|
||||
switch command {
|
||||
case "/PreUpdateReturn0.sh":
|
||||
return false, nil
|
||||
|
|
@ -89,11 +89,11 @@ func (client MockClient) ExecuteCommand(containerID string, command string, time
|
|||
}
|
||||
|
||||
// IsContainerStale is always true for the mock client
|
||||
func (client MockClient) IsContainerStale(c container.Container) (bool, error) {
|
||||
return true, nil
|
||||
func (client MockClient) IsContainerStale(_ container.Container) (bool, t.ImageID, error) {
|
||||
return true, "", nil
|
||||
}
|
||||
|
||||
// WarnOnHeadPullFailed is always true for the mock client
|
||||
func (client MockClient) WarnOnHeadPullFailed(c container.Container) bool {
|
||||
func (client MockClient) WarnOnHeadPullFailed(_ container.Container) bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue