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