mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #47172 from dwoz/cover_without_admin
Allow non admin name based runs on windows
This commit is contained in:
commit
1a600bb9a4
1 changed files with 18 additions and 11 deletions
|
@ -10,6 +10,7 @@ from __future__ import absolute_import, print_function
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
import warnings
|
||||
|
||||
TESTS_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
|
||||
if os.name == 'nt':
|
||||
|
@ -476,20 +477,26 @@ class SaltTestsuiteParser(SaltCoverageTestingParser):
|
|||
is_admin = True
|
||||
else:
|
||||
is_admin = salt.utils.win_functions.is_admin(current_user)
|
||||
if self.options.coverage and any((
|
||||
self.options.name,
|
||||
not is_admin,
|
||||
not self.options.run_destructive)) \
|
||||
and self._check_enabled_suites(include_unit=True):
|
||||
warnings.warn("Test suite not running with elevated priviledges")
|
||||
else:
|
||||
is_admin = os.geteuid() == 0
|
||||
|
||||
if self.options.coverage and any((
|
||||
self.options.name,
|
||||
not is_admin,
|
||||
not self.options.run_destructive)) \
|
||||
and self._check_enabled_suites(include_unit=True):
|
||||
self.error(
|
||||
'No sense in generating the tests coverage report when '
|
||||
'not running the full test suite, including the '
|
||||
'destructive tests, as \'root\'. It would only produce '
|
||||
'incorrect results.'
|
||||
)
|
||||
if self.options.coverage and any((
|
||||
self.options.name,
|
||||
not is_admin,
|
||||
not self.options.run_destructive)) \
|
||||
and self._check_enabled_suites(include_unit=True):
|
||||
self.error(
|
||||
'No sense in generating the tests coverage report when '
|
||||
'not running the full test suite, including the '
|
||||
'destructive tests, as \'root\'. It would only produce '
|
||||
'incorrect results.'
|
||||
)
|
||||
|
||||
# When no tests are specifically enumerated on the command line, setup
|
||||
# a default run: +unit -cloud_provider
|
||||
|
|
Loading…
Add table
Reference in a new issue