Blame SOURCES/0266-test-sysv-generator-Check-for-network-online.target.patch

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