ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: close processes test for appveyor fix [Forced Update!]
Date Thu, 29 Jun 2017 08:56:17 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-237-Support-for-resuming-failed-workflow-executions 247856541 -> caca331ee
(forced update)


close processes test for appveyor fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/caca331e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/caca331e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/caca331e

Branch: refs/heads/ARIA-237-Support-for-resuming-failed-workflow-executions
Commit: caca331eec9a3d989bf248baa4de0b08e1194bc0
Parents: 53dc64e
Author: max-orlov <maxim@gigaspaces.com>
Authored: Thu Jun 29 10:55:54 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Thu Jun 29 11:56:12 2017 +0300

----------------------------------------------------------------------
 .../workflows/executor/test_process_executor.py | 26 +++++++++++++++-----
 tox.ini                                         |  2 +-
 2 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/caca331e/tests/orchestrator/workflows/executor/test_process_executor.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor.py b/tests/orchestrator/workflows/executor/test_process_executor.py
index 6cac288..8da0018 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor.py
@@ -39,6 +39,9 @@ from tests.fixtures import (  # pylint: disable=unused-import
 from . import MockContext
 
 
+IS_WINDOWS = os.name == 'nt'
+
+
 class TestProcessExecutor(object):
 
     def test_plugin_execution(self, executor, mock_plugin, model):
@@ -94,16 +97,23 @@ class TestProcessExecutor(object):
         def wait_for_extra_process_id():
             return fs_test_holder.get('subproc', False)
 
-        pids = [executor._tasks[ctx.task.id].proc.pid, wait_for_extra_process_id()]
-        assert any(p.pid == pid for p in psutil.process_iter() for pid in pids)
+        task_pid = executor._tasks[ctx.task.id].proc.pid
+        extra_process_pid = wait_for_extra_process_id()
+
+        assert set([task_pid, extra_process_pid]).issubset(set(psutil.pids()))
         executor.terminate(ctx.task.id)
 
         # Give a chance to the processes to terminate
         time.sleep(10) # windows might require more time
-        assert not any(p.pid == pid and p.status() != psutil.STATUS_ZOMBIE
-                       for p in psutil.process_iter()
-                       for pid in pids)
 
+        # all processes should be either zombies or non existent
+        pids = [task_pid, extra_process_pid]
+        for pid in pids:
+            if pid in psutil.pids():
+                assert psutil.Process(pid).status() == psutil.STATUS_ZOMBIE
+            else:
+                # just to making the test more readable
+                assert pid not in psutil.pids()
 
 @pytest.fixture
 def fs_test_holder(tmpdir):
@@ -139,6 +149,10 @@ def model(tmpdir):
 @operation
 def freezing_task(holder_path, **_):
     holder = FilesystemDataHolder(holder_path)
-    holder['subproc'] = subprocess.Popen('while true; do sleep 5; done', shell=True).pid
+    if IS_WINDOWS:
+        command = 'for %a in (0 1 2 3 4 5 6 7 8 9 10) do timeout 60'
+    else:
+        command = 'while true; do sleep 5; done'
+    holder['subproc'] = subprocess.Popen(command, shell=True).pid
     while True:
         time.sleep(5)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/caca331e/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 3e1fb3c..796df97 100644
--- a/tox.ini
+++ b/tox.ini
@@ -46,7 +46,7 @@ commands=pytest tests/end2end --cov-report term-missing --cov aria
 commands=pytest tests/end2end --cov-report term-missing --cov aria
 
 [testenv:pywin]
-commands=pytest tests --ignore=tests/end2end --ignore=tests/orchestrator/execution_plugin/test_ssh.py
--cov-report term-missing --cov aria
+commands=pytest tests/orchestrator/workflows/executor/test_process_executor.py
 
 [testenv:py27ssh]
 install_command=pip install {opts} {packages} .[ssh]


Mime
View raw message