mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-21 21:30:48 +02:00
add buildfilter test
This commit is contained in:
parent
f309ad4596
commit
e539199eb4
1 changed files with 20 additions and 0 deletions
|
@ -138,6 +138,26 @@ func TestFilterByNoneScope(t *testing.T) {
|
|||
container.AssertExpectations(t)
|
||||
}
|
||||
|
||||
func TestBuildFilterNoneScope(t *testing.T) {
|
||||
filter, desc := BuildFilter(nil, nil, false, "none")
|
||||
|
||||
assert.Contains(t, desc, "without a scope")
|
||||
|
||||
scoped := new(mocks.FilterableContainer)
|
||||
scoped.On("Enabled").Return(false, false)
|
||||
scoped.On("Scope").Return("anyscope", true)
|
||||
|
||||
unscoped := new(mocks.FilterableContainer)
|
||||
unscoped.On("Enabled").Return(false, false)
|
||||
unscoped.On("Scope").Return("", false)
|
||||
|
||||
assert.False(t, filter(scoped))
|
||||
assert.True(t, filter(unscoped))
|
||||
|
||||
scoped.AssertExpectations(t)
|
||||
unscoped.AssertExpectations(t)
|
||||
}
|
||||
|
||||
func TestFilterByDisabledLabel(t *testing.T) {
|
||||
filter := FilterByDisabledLabel(NoFilter)
|
||||
assert.NotNil(t, filter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue