chiark / gitweb /
systemd-sysv-generator test: test scripts with hidden suffixes
authorMartin Pitt <martin.pitt@ubuntu.com>
Wed, 21 Jan 2015 14:30:01 +0000 (15:30 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Wed, 21 Jan 2015 14:30:01 +0000 (15:30 +0100)
We don't expect any unit generated from temporary package manager, swap, and
similar files.

test/sysv-generator-test.py

index a3daa9f..df13c98 100644 (file)
@@ -313,6 +313,20 @@ class SysvGeneratorTest(unittest.TestCase):
         self.assertEqual(os.readlink(os.path.join(self.out_dir, 'bar.service')),
                          'foo.service')
 
+    def test_hidden_files(self):
+        '''init.d script with hidden file suffix'''
+
+        script = self.add_sysv('foo', {}, enable=True)
+        # backup files (not enabled in rcN.d/)
+        shutil.copy(script, script + '.dpkg-new')
+        shutil.copy(script, script + '.dpkg-dist')
+        shutil.copy(script, script + '.swp')
+        shutil.copy(script, script + '.rpmsave')
+
+        err, results = self.run_generator()
+        self.assertEqual(list(results), ['foo.service'])
+
+        self.assert_enabled('foo.service', [2, 3, 4, 5])
 
 
 if __name__ == '__main__':