Test exclude patterns

This commit is contained in:
Einar Forselv 2019-04-17 02:45:01 +02:00
parent 9397a87655
commit d809496eb2
1 changed files with 31 additions and 2 deletions

View File

@ -109,9 +109,38 @@ class ResticBackupTests(unittest.TestCase):
web_service = cnt.get_service('web')
self.assertNotEqual(web_service, None, msg="Web service not found")
mounts = list(web_service.filter_mounts())
mounts = web_service.filter_mounts()
self.assertEqual(len(mounts), 1)
self.assertEqual(mounts[0].source, '/srv/files/media')
def test_exclude(self):
pass
containers = self.createContainers()
containers += [
{
'service': 'web',
'labels': {
'restic-volume-backup.exclude': 'stuff',
},
'mounts': [
{
'Source': '/srv/files/media',
'Destination': '/srv/media',
'Type': 'bind',
},
{
'Source': '/srv/files/stuff',
'Destination': '/srv/stuff',
'Type': 'bind',
},
]
},
]
with mock.patch(list_containers_func, fixtures.containers(containers=containers)):
cnt = RunningContainers()
web_service = cnt.get_service('web')
self.assertNotEqual(web_service, None, msg="Web service not found")
mounts = web_service.filter_mounts()
self.assertEqual(len(mounts), 1)
self.assertEqual(mounts[0].source, '/srv/files/media')