Skip to content

Commit

Permalink
minor: release bamboo_engine 2.8.1 (#173)
Browse files Browse the repository at this point in the history
* minor: release bamboo_engine 2.8.1

* test: 补充一部分单元测试
  • Loading branch information
hanshuaikang authored Aug 25, 2023
1 parent 8d29749 commit 4ce5fc5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bamboo_engine/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
specific language governing permissions and limitations under the License.
"""

__version__ = "2.8.0"
__version__ = "2.8.1"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down
33 changes: 33 additions & 0 deletions tests/engine/test_engine_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4ce5fc5

Please sign in to comment.