Merge pull request #44856 from Ch3LL/running_test

Add state.running ssh integration test
This commit is contained in:
Nicole Thomas 2018-01-08 16:40:49 -05:00 committed by GitHub
commit 8d04c2b3d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,4 @@
sleep_running:
module.run:
- name: test.sleep
- length: 10

View file

@ -4,6 +4,7 @@
from __future__ import absolute_import
import os
import shutil
import time
# Import Salt Testing Libs
from tests.support.case import SSHCase
@ -159,6 +160,25 @@ class SSHStateTest(SSHCase):
check_file = self.run_function('file.file_exists', [SSH_SLS_FILE], wipe=False)
self.assertTrue(check_file)
def test_state_running(self):
'''
test state.running with salt-ssh
'''
start_sls = self.run_function('state.sls', ['running', '&'],
wipe=False)
time.sleep(8)
get_sls = self.run_function('state.running', wipe=False)
ret = 'The function "state.pkg" is running as'
self.assertIn(ret, ' '.join(get_sls))
# make sure we wait until the earlier state is complete
future = time.time() + 120
while True:
if time.time() > future:
break
if ret not in ' '.join(self.run_function('state.running', wipe=False)):
break
def tearDown(self):
'''
make sure to clean up any old ssh directories