mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add more tests to whitelist for Windows
This commit is contained in:
parent
9004422d84
commit
ccbcb5588a
10 changed files with 80 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
|||
{% set result = '/bin/ls' | is_bin_file() %}
|
||||
{% if grains['os'] == 'Windows' %}
|
||||
{% set result = 'c:\Windows\System32\cmd.exe' | is_bin_file() %}
|
||||
{% else %}
|
||||
{% set result = '/bin/ls' | is_bin_file() %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'jinja_filters/common.sls' %}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
{% set result = '/dev/null' | is_empty() %}
|
||||
{% if grains['os'] == 'Windows' %}
|
||||
{% set result = 'c:\\empty_file' | is_empty() %}
|
||||
{% else %}
|
||||
{% set result = '/dev/null' | is_empty() %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'jinja_filters/common.sls' %}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
{% set result = '/etc/passwd' | is_text_file() %}
|
||||
{% if grains['os'] == 'Windows' %}
|
||||
{% set result = 'c:\Windows\system.ini' | is_text_file() %}
|
||||
{% else %}
|
||||
{% set result = '/etc/passwd' | is_text_file() %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'jinja_filters/common.sls' %}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
{% set result = '/bin' | list_files() %}
|
||||
{% if grains['os'] == 'Windows' %}
|
||||
{% set result = 'c:\salt\conf' | list_files() %}
|
||||
{% else %}
|
||||
{% set result = '/bin' | list_files() %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'jinja_filters/common.sls' %}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
{% set result = '/etc/passwd' | file_hashsum() %}
|
||||
{% if grains['os'] == 'windows' %}
|
||||
{% set result = 'c:\\Windows\\system.ini' | is_text_file() %}
|
||||
{% else %}
|
||||
{% set result = '/etc/passwd' | is_text_file() %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'jinja_filters/common.sls' %}
|
||||
|
|
|
@ -34,8 +34,8 @@ __virtualname__ = 'runtests_log_handler'
|
|||
def __virtual__():
|
||||
if 'runtests_log_port' not in __opts__:
|
||||
return False, "'runtests_log_port' not in options"
|
||||
if six.PY3:
|
||||
return False, "runtests external logging handler is temporarily disabled for Python 3 tests"
|
||||
# if six.PY3:
|
||||
# return False, "runtests external logging handler is temporarily disabled for Python 3 tests"
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -179,9 +179,14 @@ class FileModuleTest(ModuleCase):
|
|||
|
||||
def test_cannot_remove(self):
|
||||
ret = self.run_function('file.remove', arg=['tty'])
|
||||
self.assertEqual(
|
||||
'ERROR executing \'file.remove\': File path must be absolute: tty', ret
|
||||
)
|
||||
if salt.utils.platform.is_windows():
|
||||
self.assertEqual(
|
||||
'ERROR: Path not found: tty', ret
|
||||
)
|
||||
else:
|
||||
self.assertEqual(
|
||||
'ERROR executing \'file.remove\': File path must be absolute: tty', ret
|
||||
)
|
||||
|
||||
def test_source_list_for_single_file_returns_unchanged(self):
|
||||
ret = self.run_function('file.source_list', ['salt://http/httpd.conf',
|
||||
|
|
|
@ -48,7 +48,7 @@ class NaclTest(ModuleCase):
|
|||
pk = ret['pk']
|
||||
sk = ret['sk']
|
||||
|
||||
unencrypted_data = salt.utils.stringutils.to_bytes('hello')
|
||||
unencrypted_data = salt.utils.stringutils.to_str('hello')
|
||||
|
||||
# Encrypt with pk
|
||||
ret = self.run_function(
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import os
|
||||
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
import salt.utils.platform
|
||||
import salt.utils.files
|
||||
|
||||
|
||||
class JinjaFiltersTest(object):
|
||||
|
@ -173,12 +179,19 @@ class JinjaFiltersTest(object):
|
|||
'''
|
||||
test jinja filter files.is_empty
|
||||
'''
|
||||
_expected = {'ret': True}
|
||||
ret = self.run_function('state.sls',
|
||||
['jinja_filters.files_is_empty'])
|
||||
self.assertIn('module_|-test_|-test.echo_|-run', ret)
|
||||
self.assertEqual(ret['module_|-test_|-test.echo_|-run']['changes'],
|
||||
_expected)
|
||||
try:
|
||||
if salt.utils.platform.is_windows():
|
||||
with salt.utils.files.fopen('c:\\empty_file', 'w') as fp:
|
||||
pass
|
||||
_expected = {'ret': True}
|
||||
ret = self.run_function('state.sls',
|
||||
['jinja_filters.files_is_empty'])
|
||||
self.assertIn('module_|-test_|-test.echo_|-run', ret)
|
||||
self.assertEqual(ret['module_|-test_|-test.echo_|-run']['changes'],
|
||||
_expected)
|
||||
except:
|
||||
if salt.utils.platform.is_windows():
|
||||
os.remove('c:\\empty_file')
|
||||
|
||||
def test_files_is_text(self):
|
||||
'''
|
||||
|
@ -198,8 +211,12 @@ class JinjaFiltersTest(object):
|
|||
ret = self.run_function('state.sls',
|
||||
['jinja_filters.files_list_files'])
|
||||
self.assertIn('module_|-test_|-test.echo_|-run', ret)
|
||||
self.assertIn('/bin/ls',
|
||||
ret['module_|-test_|-test.echo_|-run']['changes']['ret'])
|
||||
if salt.utils.platform.is_windows():
|
||||
self.assertIn('c:\\\\salt\\\\conf\\\\minion',
|
||||
ret['module_|-test_|-test.echo_|-run']['changes']['ret'])
|
||||
else:
|
||||
self.assertIn('/bin/ls',
|
||||
ret['module_|-test_|-test.echo_|-run']['changes']['ret'])
|
||||
|
||||
def test_hashutils_base4_64decode(self):
|
||||
'''
|
||||
|
@ -591,7 +608,7 @@ class JinjaFiltersTest(object):
|
|||
'''
|
||||
test jinja filter path.join
|
||||
'''
|
||||
_expected = {'ret': '/a/b/c/d'}
|
||||
_expected = {'ret': os.path.sep + os.path.join('a', 'b', 'c', 'd')}
|
||||
ret = self.run_function('state.sls',
|
||||
['jinja_filters.path_join'])
|
||||
self.assertIn('module_|-test_|-test.echo_|-run', ret)
|
||||
|
@ -670,6 +687,7 @@ class JinjaFiltersTest(object):
|
|||
self.assertEqual(ret['module_|-test_|-test.echo_|-run']['changes'],
|
||||
_expected)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on windows')
|
||||
def test_user_get_uid(self):
|
||||
'''
|
||||
test jinja filter user.get_uid
|
||||
|
|
|
@ -20,20 +20,37 @@ integration.modules.test_cmdmod
|
|||
integration.modules.test_config
|
||||
integration.modules.test_cp
|
||||
integration.modules.test_data
|
||||
integration.modules.test_decorators
|
||||
integration.modules.test_disk
|
||||
integration.modules.test_event
|
||||
integration.modules.test_file
|
||||
integration.modules.test_gem
|
||||
integration.modules.test_gentoolkitmod
|
||||
integration.modules.test_win_firewall
|
||||
integration.modules.test_git
|
||||
integration.modules.test_grains
|
||||
integration.modules.test_groupadd
|
||||
integration.modules.test_hosts
|
||||
integration.modules.test_key
|
||||
integration.modules.test_linux_acl
|
||||
integration.modules.test_localemod
|
||||
integration.modules.test_lxc
|
||||
integration.modules.test_mine
|
||||
integration.modules.test_mysql
|
||||
integration.modules.test_nacl
|
||||
integration.modules.test_network
|
||||
integration.modules.test_nilrt_ip
|
||||
integration.modules.test_win_ntp
|
||||
integration.modules.test_pillar
|
||||
integration.modules.test_pip
|
||||
integration.modules.test_pkg
|
||||
integration.modules.test_publish
|
||||
integration.modules.test_pw_user
|
||||
integration.modules.test_rabbitmq
|
||||
integration.modules.test_saltutil
|
||||
integration.modules.test_service
|
||||
integration.modules.test_shadow
|
||||
integration.modules.test_ssh
|
||||
integration.modules.test_state
|
||||
integration.modules.test_status
|
||||
integration.modules.test_sysmod
|
||||
|
|
Loading…
Add table
Reference in a new issue