From 7727e09fc785f360eaaa1b091a06d4eb9938924b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu> Date: Tue, 7 Feb 2017 09:30:34 +0100 Subject: [PATCH] Start MS tests if MS is present (refs #19907). --- tester.py | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/tester.py b/tester.py index e71bbabd..3377accf 100755 --- a/tester.py +++ b/tester.py @@ -35,8 +35,7 @@ sys.stderr = sys.stdout class Tester(): - USAGE = '''%s [-ms] [-e] [-d] [-h] - -ms: run MediaServer tests in addition of standard tests. + USAGE = '''%s [-e] [-d] [-h] -e: send email with report. -d: debug mode (can be started with non root users). -h: show this message.''' % __file__ @@ -71,8 +70,7 @@ class Tester(): sys.exit(1) # Check for email value email = '-e' in args - ms = '-ms' in args - tests = self.discover_tests(ms) + tests = self.discover_tests() if not tests: sys.exit(1) exit_code = self.run_tests(tests, email) @@ -99,7 +97,7 @@ class Tester(): break return description.strip() - def discover_tests(self, ms=False): + def discover_tests(self): tests = list() # Get standard tests path = os.path.join(self.root_dir, 'tests') @@ -116,8 +114,13 @@ class Tester(): if os.path.isfile(test_path): description = self.get_file_description(test_path) tests.append((name, description, [test_path])) + # Get MS instances + ms_users = list() + for user in os.listdir('/home'): + if os.path.exists('/home/%s/msinstance' % user): + ms_users.append(user) # Get MediaServer tests - if ms: + if ms_users: # Clone testing suite ms_path = os.path.join(path, 'ms-testing-suite') if os.path.exists(ms_path): @@ -128,20 +131,15 @@ class Tester(): else: log('Cloning ms-testing-suite in "%s".' % ms_path) subprocess.check_call(['git', 'clone', 'https://git.ubicast.net/mediaserver/ms-testing-suite.git', ms_path]) - ms_tests = ['ms_vod_tester.py'] - # Get MS instances - users = list() - for user in os.listdir('/home'): - if os.path.exists('/home/%s/msinstance' % user): - users.append(user) - # check that Wowza is installed - wowza_dir = '/usr/local/WowzaStreamingEngine' - if not os.path.exists(wowza_dir): - log('Wowza is not installed ("%s" does not exist), the live test will not be run.' % wowza_dir) - else: - ms_tests.append('ms_live_tester.py') # Add tests to list - for user in users: + wowza_dir = '/usr/local/WowzaStreamingEngine' + etc_lives_conf = '/etc/mediaserver/lives_conf.py' + local_lives_conf = '/home/%s/msinstance/conf/lives_conf.py' + for user in ms_users: + ms_tests = ['ms_vod_tester.py'] + # Check if live tests should be started + if os.path.exists(wowza_dir) or os.path.exists(etc_lives_conf) or os.path.exists(local_lives_conf % user): + ms_tests.append('ms_live_tester.py') for name in ms_tests: test_path = os.path.join(ms_path, name) description = self.get_file_description(test_path) -- GitLab