

def test_tag_exclude_all(self):
    ' exclude all, except ubuntu and debian. '
    instance = {
        'include': ['docker_image:ubuntu', 'docker_image:debian'],
        'exclude': ['.*'],
    }
    klass = get_check_class('docker')
    with patch.object(klass, '_find_cgroup', _mocked_find_cgroup):
        check = klass('docker', {
            
        }, {
            
        })
    check._prepare_filters(instance)
    self.assertEquals(len(instance['exclude_patterns']), 1)
    self.assertEquals(len(instance['include_patterns']), 2)
    truth_table_exclusion = {
        'some_tag': True,
        'debian:ubuntu': True,
        'docker_image:centos': True,
        'docker_image:ubuntu': False,
        'docker_image:debian': False,
    }
    for (tag, val) in truth_table_exclusion.iteritems():
        self.assertEquals(check._is_container_excluded(instance, [tag]), val, '{0} expected {1} but is not'.format(tag, val))

dataset/ETHPy150Open serverdensity/sd-agent/tests/checks/mock/test_docker.py DockerCheckTest.test_tag_exclude_all/original