mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix modified test to account for OS variances
This commit is contained in:
parent
15ee4794c3
commit
02248dcd1a
1 changed files with 15 additions and 3 deletions
|
@ -92,9 +92,21 @@ class IWatchdogBeaconTestCase(TestCase, LoaderModuleMockMixin):
|
|||
|
||||
ret = check_events(config)
|
||||
|
||||
self.assertEqual(len(ret), 1)
|
||||
self.assertEqual(ret[0]['path'], path)
|
||||
self.assertEqual(ret[0]['change'], 'modified')
|
||||
modified = False
|
||||
for event in ret:
|
||||
# "modified" requires special handling
|
||||
# A modification sometimes triggers 2 modified events depending on
|
||||
# the OS and the python version
|
||||
# When the "modified" event triggers on modify, it will have the
|
||||
# path to the temp file (path), other modified events will contain
|
||||
# the path minus "tmpfile" and will not match. That's how we'll
|
||||
# distinguish the two
|
||||
if event['change'] == 'modified':
|
||||
if event['path'] == path:
|
||||
modified = True
|
||||
|
||||
# Check results of the for loop to validate modified
|
||||
self.assertTrue(modified)
|
||||
|
||||
def test_file_deleted(self):
|
||||
path = os.path.join(self.tmpdir, 'tmpfile')
|
||||
|
|
Loading…
Add table
Reference in a new issue