1
0
mirror of https://github.com/containrrr/watchtower.git synced 2025-01-05 14:50:44 +02:00
watchtower/container/container_test.go
Simon Aronsson 1b82da1ab7 Setup a working pipeline
* add tests to ensure function even after switching docker client api version
* switch docker client api version to remove import of Sirupsen and get rid of the casing workaround
* migrate from glide to dep to go modules
* rewrite ci workflow
  * only run publish on version tags
  * only run build on branches
  * update goreleaser config
  * disable automated latest tag push
* remove dependency to v2tec/docker-gobuilder
* remove dead code and files
* add golands .idea folder to gitignore
* add label to released docker images
* add test reporting, add some unit tests
* change test output dir
* fix goreleaser versions
* add debug output for circleci and goreleaser
* disable cgo
2019-04-06 13:57:26 +02:00

26 lines
732 B
Go

package container
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestContainsWatchtowerLabel_ShouldReturnTrueIfTheWatchtowerLabelExistsOnTheContainer(t *testing.T) {
labelMap := map[string]string {
"com.centurylinklabs.watchtower": "true",
}
assert.True(t, ContainsWatchtowerLabel(labelMap))
}
func TestContainsWatchtowerLabel_ShouldReturnFalseIfTheWatchtowerLabelDoesntExistOnTheContainer(t *testing.T) {
labelMap := map[string]string {
"com.containrrr.watchtower": "lost",
}
assert.False(t, ContainsWatchtowerLabel(labelMap))
}
func TestContainsWatchtowerLabel_ShouldReturnFalseIfLabelsIsEmpty(t *testing.T) {
labelMap := map[string]string {}
assert.False(t, ContainsWatchtowerLabel(labelMap))
}