From 4ce5fc595c876e6d3b050812d743a02fd465d12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E6=95=B0?= <33194175+hanshuaikang@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:28:54 +0800 Subject: [PATCH] minor: release bamboo_engine 2.8.1 (#173) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * minor: release bamboo_engine 2.8.1 * test: 补充一部分单元测试 --- bamboo_engine/__version__.py | 2 +- pyproject.toml | 2 +- tests/engine/test_engine_api.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/bamboo_engine/__version__.py b/bamboo_engine/__version__.py index 3e1332e0..0dd3e0fe 100644 --- a/bamboo_engine/__version__.py +++ b/bamboo_engine/__version__.py @@ -11,4 +11,4 @@ specific language governing permissions and limitations under the License. """ -__version__ = "2.8.0" +__version__ = "2.8.1" diff --git a/pyproject.toml b/pyproject.toml index 16c7d11d..97eb088b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bamboo-engine" -version = "2.8.0" +version = "2.8.1" description = "Bamboo-engine is a general-purpose workflow engine" authors = ["homholueng "] license = "MIT" diff --git a/tests/engine/test_engine_api.py b/tests/engine/test_engine_api.py index 0d6af114..fc72511f 100644 --- a/tests/engine/test_engine_api.py +++ b/tests/engine/test_engine_api.py @@ -1506,3 +1506,36 @@ def test_get_execution_time_node_running(): result = api.get_node_execution_time(runtime, entity_id) assert result.result assert result.data["execution_time"] > 0 + + +def test_get_execution_time_pipeline_finished(): + entity_id = "nid" + now = datetime.datetime.now() + + state = MagicMock() + state.name = states.FINISHED + state.started_time = now + state.archived_time = now + datetime.timedelta(seconds=10) + + runtime = MagicMock() + runtime.get_state = MagicMock(return_value=state) + + result = api.get_pipeline_execution_time(runtime, entity_id) + assert result.result + assert result.data["execution_time"] == 10.0 + + +def test_get_execution_time_pipeline_running(): + entity_id = "nid" + + state = MagicMock() + state.name = states.RUNNING + state.started_time = datetime.datetime.now() + state.archived_time = None + + runtime = MagicMock() + runtime.get_state = MagicMock(return_value=state) + + result = api.get_pipeline_execution_time(runtime, entity_id) + assert result.result + assert result.data["execution_time"] > 0