@@ -245,6 +245,46 @@ def test_basic_functionality(self):
245245 self .assertEqual (len (mounts ), 2 )
246246 self .assertEqual (mounts [0 ].source , "/srv/files/media" )
247247 self .assertEqual (mounts [1 ].source , "/srv/files/stuff" )
248+
249+ def test_redundant_label (self ):
250+ """Test that a container has a redundant label and should be backed up"""
251+
252+ containers = self .createContainers ()
253+ containers += [
254+ {
255+ "service" : "web" ,
256+ "labels" : {
257+ "stack-back.volumes" : True ,
258+ },
259+ "mounts" : [
260+ {
261+ "Source" : "/srv/files/media" ,
262+ "Destination" : "/srv/media" ,
263+ "Type" : "bind" ,
264+ },
265+ {
266+ "Source" : "/srv/files/stuff" ,
267+ "Destination" : "/srv/stuff" ,
268+ "Type" : "bind" ,
269+ },
270+ ],
271+ },
272+ ]
273+ with mock .patch (
274+ list_containers_func , fixtures .containers (containers = containers )
275+ ):
276+ cnt = RunningContainers ()
277+
278+ web_service = cnt .get_service ("web" )
279+ self .assertNotEqual (web_service , None , msg = "Web service not found" )
280+
281+ mounts = web_service .filter_mounts ()
282+ print (mounts )
283+ self .assertEqual (len (mounts ), 2 )
284+ self .assertEqual (mounts [0 ].source , "/srv/files/media" )
285+ self .assertEqual (mounts [1 ].source , "/srv/files/stuff" )
286+
287+
248288
249289 def test_explicit_exclude (self ):
250290 """Test that a container can be excluded from the backup"""
0 commit comments