Add workaround to fix timeout of salt-models tests

Change-Id: I8b19fd91ccf96296180bf8c198afc5608dec0e39
diff --git a/src/com/mirantis/mk/SaltModelTesting.groovy b/src/com/mirantis/mk/SaltModelTesting.groovy
index d25d79b..3218917 100644
--- a/src/com/mirantis/mk/SaltModelTesting.groovy
+++ b/src/com/mirantis/mk/SaltModelTesting.groovy
@@ -79,8 +79,11 @@
           sh("(pgrep salt-master | sed /\$\$/d | xargs --no-run-if-empty -I {} kill -9 {} || true) && pkill -9 salt-minion || true")
           sh("service salt-master restart && service salt-minion restart && sleep 15")
         }
-
-        sh("timeout ${testTimeout} bash -c 'source /srv/salt/scripts/bootstrap.sh; cd /srv/salt/scripts && source_local_envs && saltmaster_init'")
+        def lockFile = "/var/lock/salt_master_running"
+        // Dirty hack to make sure salt-master service will run permanently
+        sh("timeout ${testTimeout} bash -c 'source /srv/salt/scripts/bootstrap.sh; cd /srv/salt/scripts && \
+            source_local_envs && touch ${lockFile} && (((saltmaster_init || exit 1); rm ${lockFile}) & \
+            (while [ -f ${lockFile} ] ; do service salt-master start && sleep 60 ; done))'")
 
         if (!legacyTestingMode) {
            sh("bash -c 'source /srv/salt/scripts/bootstrap.sh; cd /srv/salt/scripts && verify_salt_minions'")