mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
use fun_function to call cmd.run
This commit is contained in:
parent
4d150adc39
commit
a3dc2b563f
@ -44,8 +44,7 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
'''
|
||||
Determine if URL-referenced NPM module can be successfully installed.
|
||||
'''
|
||||
npm_bin = salt.utils.path.which('npm')
|
||||
npm_version = cmd.run('{} -v'.format(npm_bin), timeout=10)
|
||||
npm_version = self.run_function('cmd.run', ['npm -v'])
|
||||
if LooseVersion(npm_version) >= LooseVersion(MAX_NPM_VERSION):
|
||||
user = os.environ.get('SUDO_USER', 'root')
|
||||
npm_dir = os.path.join(RUNTIME_VARS.TMP, 'git-install-npm')
|
||||
@ -74,12 +73,13 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
ret = self.run_state('npm.installed', name='unused', pkgs=['pm2@2.10.4', 'grunt@1.0.2'], registry="http://registry.npmjs.org/")
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
@skipIf(salt.utils.path.which('npm') and LooseVersion(cmd.run('npm -v')) >= LooseVersion(MAX_NPM_VERSION),
|
||||
'Skip with npm >= 5.0.0 until #41770 is fixed')
|
||||
@destructiveTest
|
||||
def test_npm_cache_clean(self):
|
||||
'''
|
||||
Basic test to determine if NPM successfully cleans its cached packages.
|
||||
'''
|
||||
npm_version = self.run_function('cmd.run', ['npm -v'])
|
||||
if LooseVersion(npm_version) >= LooseVersion(MAX_NPM_VERSION):
|
||||
self.skipTest('Skip with npm >= 5.0.0 until #41770 is fixed')
|
||||
ret = self.run_state('npm.cache_cleaned', name='unused', force=True)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
Loading…
Reference in New Issue
Block a user