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