Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions integtests/tools/flow/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from integtests.conftest import ConfigDef
from keboola_mcp_server.clients.client import (
CONDITIONAL_FLOW_COMPONENT_ID,
ORCHESTRATOR_COMPONENT_ID,
KeboolaClient,
)
from keboola_mcp_server.config import Config, ServerRuntimeInfo
Expand Down Expand Up @@ -45,29 +44,37 @@ async def mcp_client(mcp_server: FastMCP) -> AsyncGenerator[Client, None]:


@pytest_asyncio.fixture
async def initial_lf(
async def initial_cf2(
mcp_client: Client, configs: list[ConfigDef], keboola_client: KeboolaClient
) -> AsyncGenerator[FlowToolOutput, None]:
# Create the initial component configuration test data
# A second, distinct conditional flow instance — used where tests need two independent flows
# (e.g. listing). Legacy Orchestrator (`keboola.orchestrator`) flow creation is disabled on the
# test project, so this is a Conditional Flow rather than a legacy one.
tool_result = await mcp_client.call_tool(
name='create_flow',
name='create_conditional_flow',
arguments={
'name': 'Initial Test Flow',
'description': 'Initial test flow created by automated test',
'phases': [{'name': 'Phase1', 'dependsOn': [], 'description': 'First phase'}],
'name': 'Initial Test Flow 2',
'description': 'Second initial test flow created by automated test',
'phases': [
{
'id': 'phase1',
'name': 'Phase1',
'description': 'First phase',
'next': [{'id': 'phase1_end', 'name': 'End Flow', 'goto': None}],
},
],
'tasks': [
{
'id': 20001,
'id': 'task1',
'name': 'Task1',
'phase': 1,
'continueOnFailure': False,
'enabled': False,
'phase': 'phase1',
'task': {
'type': 'job',
'componentId': configs[0].component_id,
'configId': configs[0].configuration_id,
'mode': 'run',
},
}
},
],
},
)
Expand All @@ -76,7 +83,7 @@ async def initial_lf(
finally:
# Clean up: Delete the configuration
await keboola_client.storage_client.configuration_delete(
component_id=ORCHESTRATOR_COMPONENT_ID,
component_id=CONDITIONAL_FLOW_COMPONENT_ID,
configuration_id=tool_result.structured_content['configuration_id'],
skip_trash=True,
)
Expand Down
12 changes: 6 additions & 6 deletions integtests/tools/flow/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from fastmcp import Client

from integtests.conftest import ConfigDef
from keboola_mcp_server.clients.client import ORCHESTRATOR_COMPONENT_ID, KeboolaClient
from keboola_mcp_server.clients.client import CONDITIONAL_FLOW_COMPONENT_ID, KeboolaClient
from keboola_mcp_server.tools.flow.model import GetFlowsDetailOutput
from keboola_mcp_server.tools.flow.scheduler import (
SCHEDULER_COMPONENT_ID,
Expand Down Expand Up @@ -157,7 +157,7 @@ async def test_scheduler_lifecycle(mcp_context, configs, keboola_client) -> None

@pytest.mark.asyncio
async def test_scheduler_lifecycle_tooling(
initial_lf: FlowToolOutput, mcp_client: Client, configs: list[ConfigDef], keboola_client: KeboolaClient
initial_cf: FlowToolOutput, mcp_client: Client, configs: list[ConfigDef], keboola_client: KeboolaClient
) -> None:
"""
Test scheduler lifecycle using MCP tools: create schedule for a flow, update, and remove it.
Expand All @@ -170,7 +170,7 @@ async def test_scheduler_lifecycle_tooling(
assert configs
assert configs[0].configuration_id is not None

flow_id = initial_lf.configuration_id
flow_id = initial_cf.configuration_id

schedule_id: str | None = None
try:
Expand All @@ -181,7 +181,7 @@ async def test_scheduler_lifecycle_tooling(
name='modify_flow',
arguments={
'configuration_id': flow_id,
'flow_type': ORCHESTRATOR_COMPONENT_ID,
'flow_type': CONDITIONAL_FLOW_COMPONENT_ID,
'change_description': 'Add scheduler via tooling',
'schedules': [
{
Expand Down Expand Up @@ -216,7 +216,7 @@ async def test_scheduler_lifecycle_tooling(
name='modify_flow',
arguments={
'configuration_id': flow_id,
'flow_type': ORCHESTRATOR_COMPONENT_ID,
'flow_type': CONDITIONAL_FLOW_COMPONENT_ID,
'change_description': 'Update scheduler via tooling',
'schedules': [
{
Expand Down Expand Up @@ -249,7 +249,7 @@ async def test_scheduler_lifecycle_tooling(
name='modify_flow',
arguments={
'configuration_id': flow_id,
'flow_type': ORCHESTRATOR_COMPONENT_ID,
'flow_type': CONDITIONAL_FLOW_COMPONENT_ID,
'change_description': 'Remove scheduler via tooling',
'schedules': [{'action': 'remove', 'schedule_id': schedule_id}],
},
Expand Down
Loading
Loading