-
Notifications
You must be signed in to change notification settings - Fork 299
feat: make bootstrapper initialiser timeouts configurable (#874) #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cybermaggedon
merged 2 commits into
trustgraph-ai:release/v2.6
from
corvus-0x:feat/configurable-bootstrap-timeouts
Jun 30, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """ | ||
| Unit tests for trustgraph.bootstrap.initialisers.DefaultFlowStart | ||
|
|
||
| Verifies the list/start timeouts are configurable and that the | ||
| configured values actually reach the flow-client request calls. | ||
| """ | ||
|
|
||
| from unittest.mock import AsyncMock, MagicMock | ||
|
|
||
| import pytest | ||
|
|
||
| from trustgraph.bootstrap.initialisers.default_flow_start import ( | ||
| DefaultFlowStart, | ||
| ) | ||
|
|
||
|
|
||
| def test_default_timeouts(): | ||
| init = DefaultFlowStart(blueprint="bp") | ||
| assert init.list_timeout == 10 | ||
| assert init.start_timeout == 30 | ||
|
|
||
|
|
||
| def test_timeout_overrides_are_stored(): | ||
| init = DefaultFlowStart(blueprint="bp", list_timeout=5, start_timeout=99) | ||
| assert init.list_timeout == 5 | ||
| assert init.start_timeout == 99 | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_run_forwards_configured_timeouts(): | ||
| init = DefaultFlowStart(blueprint="bp", list_timeout=5, start_timeout=99) | ||
|
|
||
| # Flow client: list-flows returns no error + empty flow list, | ||
| # start-flow returns no error. | ||
| flow = MagicMock() | ||
| flow.start = AsyncMock() | ||
| flow.stop = AsyncMock() | ||
| flow.request = AsyncMock(side_effect=[ | ||
| MagicMock(error=None, flow_ids=[]), # list-flows response | ||
| MagicMock(error=None), # start-flow response | ||
| ]) | ||
|
|
||
| # Context: workspace "default" exists, hands back our mock flow client. | ||
| ctx = MagicMock() | ||
| ctx.logger = MagicMock() | ||
| ctx.config.keys = AsyncMock(return_value=["default"]) | ||
| ctx.make_flow_client = MagicMock(return_value=flow) | ||
|
|
||
| await init.run(ctx, None, "v1") | ||
|
|
||
| calls = flow.request.call_args_list | ||
| assert len(calls) == 2 | ||
| assert calls[0].kwargs["timeout"] == 5 | ||
| assert calls[1].kwargs["timeout"] == 99 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| """Unit tests for trustgraph.bootstrap.initialisers.WorkspaceInit.""" | ||
|
|
||
| from trustgraph.bootstrap.initialisers.workspace_init import WorkspaceInit | ||
|
|
||
|
|
||
| def test_default_iam_timeout(): | ||
| init = WorkspaceInit() | ||
| assert init.iam_timeout == 10 | ||
|
|
||
|
|
||
| def test_iam_timeout_override_is_stored(): | ||
| init = WorkspaceInit(iam_timeout=42) | ||
| assert init.iam_timeout == 42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.