ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
923a60
From e955c2298241b9a2957dd8d36c48cbfe0a108d49 Mon Sep 17 00:00:00 2001
923a60
From: Branislav Blaskovic <bblaskov@redhat.com>
923a60
Date: Sat, 7 Nov 2015 11:32:49 +0100
923a60
Subject: [PATCH] test sysv-generator: Check for network-online.target.
923a60
923a60
Resolves: #1279034
923a60
---
923a60
 test/sysv-generator-test.py | 18 ++++++++++++------
923a60
 1 file changed, 12 insertions(+), 6 deletions(-)
923a60
923a60
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
923a60
index 153786417a..2060ad754e 100644
923a60
--- a/test/sysv-generator-test.py
923a60
+++ b/test/sysv-generator-test.py
923a60
@@ -225,21 +225,27 @@ class SysvGeneratorTest(unittest.TestCase):
923a60
                               'Should-Start': 'may1 ne_may2'},
923a60
                       enable=True, prio=40)
923a60
         self.add_sysv('must1', {}, enable=True, prio=10)
923a60
+        self.add_sysv('prio10', {}, enable=True, prio=10)
923a60
+        self.add_sysv('prio11', {}, enable=True, prio=11)
923a60
         self.add_sysv('must2', {}, enable=True, prio=15)
923a60
         self.add_sysv('may1', {}, enable=True, prio=20)
923a60
         # do not create ne_may2
923a60
         err, results = self.run_generator()
923a60
         self.assertEqual(sorted(results),
923a60
-                         ['foo.service', 'may1.service', 'must1.service', 'must2.service'])
923a60
+                         ['foo.service', 'may1.service', 'must1.service', 'must2.service', 'prio10.service', 'prio11.service'])
923a60
 
923a60
         # foo should depend on all of them
923a60
+        print results['foo.service'].get('Unit', 'After')
923a60
         self.assertEqual(sorted(results['foo.service'].get('Unit', 'After').split()),
923a60
-                         ['may1.service', 'must1.service', 'must2.service', 'ne_may2.service'])
923a60
+                         ['may1.service', 'must1.service', 'must2.service', 'ne_may2.service', 'network-online.target'])
923a60
 
923a60
+        # from prio 10 network-online.target is default dependency (src/sysv-generator/sysv-generator.c)
923a60
+        self.assertEqual(sorted(results['must2.service'].get('Unit', 'After').split()), ['network-online.target'])
923a60
+        self.assertEqual(sorted(results['may1.service'].get('Unit', 'After').split()), ['network-online.target'])
923a60
+        self.assertEqual(sorted(results['prio11.service'].get('Unit', 'After').split()), ['network-online.target'])
923a60
         # other services should not depend on each other
923a60
         self.assertFalse(results['must1.service'].has_option('Unit', 'After'))
923a60
-        self.assertFalse(results['must2.service'].has_option('Unit', 'After'))
923a60
-        self.assertFalse(results['may1.service'].has_option('Unit', 'After'))
923a60
+        self.assertFalse(results['prio10.service'].has_option('Unit', 'After'))
923a60
 
923a60
     def test_symlink_prio_deps(self):
923a60
         '''script without LSB headers use rcN.d priority'''
923a60
@@ -259,8 +265,8 @@ class SysvGeneratorTest(unittest.TestCase):
923a60
         err, results = self.run_generator()
923a60
         self.assertEqual(sorted(results), ['consumer.service', 'provider.service'])
923a60
         self.assertFalse(results['provider.service'].has_option('Unit', 'After'))
923a60
-        self.assertEqual(results['consumer.service'].get('Unit', 'After'),
923a60
-                         'provider.service')
923a60
+        self.assertEqual(results['consumer.service'].get('Unit', 'After').split(),
923a60
+                         ['network-online.target', 'provider.service'])
923a60
 
923a60
     def test_multiple_provides(self):
923a60
         '''multiple Provides: names'''