feat: add workspace foundation

This commit is contained in:
a.tolmachev
2026-03-29 21:45:53 +03:00
parent d3ab565fff
commit d757adb192
19 changed files with 743 additions and 109 deletions
+13 -4
View File
@@ -53,6 +53,7 @@ mod tests {
use crank_core::{
DescriptorId, ExecutionConfig, GraphqlOperationType, GraphqlTarget, GrpcTarget, HttpMethod,
Operation, OperationId, OperationStatus, Protocol, RestTarget, Target, ToolDescription,
WorkspaceId,
};
use crank_mapping::{MappingRule, MappingSet};
use crank_registry::{PostgresRegistry, PublishRequest};
@@ -63,6 +64,10 @@ mod tests {
use crate::app::build_app;
fn test_workspace_id() -> WorkspaceId {
WorkspaceId::new("ws_default")
}
#[tokio::test]
async fn initializes_lists_and_calls_published_tool_via_mcp() {
let registry = test_registry().await;
@@ -70,11 +75,12 @@ mod tests {
let operation = test_operation(&upstream_base_url, "crm_create_lead");
registry
.create_operation(&operation, Some("alice"))
.create_operation(&test_workspace_id(), &operation, Some("alice"))
.await
.unwrap();
registry
.publish_operation(PublishRequest {
workspace_id: &test_workspace_id(),
operation_id: &operation.id,
version: 1,
published_at: "2026-03-26T10:00:00Z",
@@ -137,11 +143,12 @@ mod tests {
let operation = test_graphql_operation(&endpoint, "crm_create_lead_graphql");
registry
.create_operation(&operation, Some("alice"))
.create_operation(&test_workspace_id(), &operation, Some("alice"))
.await
.unwrap();
registry
.publish_operation(PublishRequest {
workspace_id: &test_workspace_id(),
operation_id: &operation.id,
version: 1,
published_at: "2026-03-26T10:00:00Z",
@@ -191,11 +198,12 @@ mod tests {
let operation = test_grpc_operation(&server_addr, "echo_unary_grpc");
registry
.create_operation(&operation, Some("alice"))
.create_operation(&test_workspace_id(), &operation, Some("alice"))
.await
.unwrap();
registry
.publish_operation(PublishRequest {
workspace_id: &test_workspace_id(),
operation_id: &operation.id,
version: 1,
published_at: "2026-03-26T10:00:00Z",
@@ -318,11 +326,12 @@ mod tests {
let operation = test_operation(&upstream_base_url, "crm_publish_later");
registry
.create_operation(&operation, Some("alice"))
.create_operation(&test_workspace_id(), &operation, Some("alice"))
.await
.unwrap();
registry
.publish_operation(PublishRequest {
workspace_id: &test_workspace_id(),
operation_id: &operation.id,
version: 1,
published_at: "2026-03-26T10:00:00Z",