Merge pull request #49710 from rallytime/merge-2018.3

[2018.3] Merge forward from 2017.7 to 2018.3
This commit is contained in:
Nicole Thomas 2018-09-19 14:05:49 -04:00 committed by GitHub
commit 936cae5017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -11,6 +11,7 @@ import os
import sys
import time
import warnings
import collections
TESTS_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
if os.name == 'nt':
@ -97,7 +98,7 @@ MAX_OPEN_FILES = {
# Combine info from command line options and test suite directories. A test
# suite is a python package of test modules relative to the tests directory.
TEST_SUITES = {
TEST_SUITES_UNORDERED = {
'unit':
{'display_name': 'Unit',
'path': 'unit'},
@ -181,6 +182,9 @@ TEST_SUITES = {
'path': 'integration/scheduler'},
}
TEST_SUITES = collections.OrderedDict(sorted(TEST_SUITES_UNORDERED.items(),
key=lambda x: x[0]))
class SaltTestsuiteParser(SaltCoverageTestingParser):
support_docker_execution = True

View File

@ -788,28 +788,24 @@ class StateTestCase(TestCase, LoaderModuleMockMixin):
Test to clear out the state execution request without executing it
'''
mock = MagicMock(return_value=True)
with patch.object(os.path, 'join', mock):
mock = MagicMock(return_value=True)
with patch.object(salt.payload, 'Serial', mock):
mock = MagicMock(side_effect=[False, True, True])
with patch.object(os.path, 'isfile', mock):
self.assertTrue(state.clear_request("A"))
with patch.object(salt.payload, 'Serial', mock):
mock = MagicMock(side_effect=[False, True, True])
with patch.object(os.path, 'isfile', mock):
self.assertTrue(state.clear_request("A"))
mock = MagicMock(return_value=True)
with patch.object(os, 'remove', mock):
self.assertTrue(state.clear_request())
mock = MagicMock(return_value=True)
with patch.object(os, 'remove', mock):
self.assertTrue(state.clear_request())
mock = MagicMock(return_value={})
with patch.object(state, 'check_request', mock):
self.assertFalse(state.clear_request("A"))
mock = MagicMock(return_value={})
with patch.object(state, 'check_request', mock):
self.assertFalse(state.clear_request("A"))
def test_check_request(self):
'''
Test to return the state request information
'''
mock = MagicMock(return_value=True)
with patch.object(os.path, 'join', mock), \
patch('salt.modules.state.salt.payload', MockSerial):
with patch('salt.modules.state.salt.payload', MockSerial):
mock = MagicMock(side_effect=[True, True, False])
with patch.object(os.path, 'isfile', mock):
with patch('salt.utils.files.fopen', mock_open()):