diff --git a/testing-framework/core/src/scenario/runtime/orchestration/source_orchestration_plan.rs b/testing-framework/core/src/scenario/runtime/orchestration/source_orchestration_plan.rs index c9c99f9..2c3cb4e 100644 --- a/testing-framework/core/src/scenario/runtime/orchestration/source_orchestration_plan.rs +++ b/testing-framework/core/src/scenario/runtime/orchestration/source_orchestration_plan.rs @@ -73,8 +73,11 @@ mod tests { #[test] fn attached_sources_are_planned() { - let sources = ScenarioSources::default() - .with_attach(ExistingCluster::compose(vec!["node-0".to_string()])); + let sources = + ScenarioSources::default().with_attach(ExistingCluster::for_compose_services( + "test-project".to_string(), + vec!["node-0".to_string()], + )); let plan = SourceOrchestrationPlan::try_from_sources(&sources) .expect("attached sources should build a source orchestration plan"); diff --git a/testing-framework/core/src/scenario/sources/model.rs b/testing-framework/core/src/scenario/sources/model.rs index 566e2ee..a64b010 100644 --- a/testing-framework/core/src/scenario/sources/model.rs +++ b/testing-framework/core/src/scenario/sources/model.rs @@ -18,8 +18,7 @@ enum ExistingClusterKind { impl ExistingCluster { #[must_use] - #[doc(hidden)] - pub fn k8s(label_selector: String) -> Self { + pub fn for_k8s_selector(label_selector: String) -> Self { Self { kind: ExistingClusterKind::K8s { namespace: None, @@ -29,8 +28,7 @@ impl ExistingCluster { } #[must_use] - #[doc(hidden)] - pub fn k8s_in_namespace(label_selector: String, namespace: String) -> Self { + pub fn for_k8s_selector_in_namespace(namespace: String, label_selector: String) -> Self { Self { kind: ExistingClusterKind::K8s { namespace: Some(namespace), @@ -40,19 +38,17 @@ impl ExistingCluster { } #[must_use] - #[doc(hidden)] - pub fn compose(services: Vec) -> Self { + pub fn for_compose_project(project: String) -> Self { Self { kind: ExistingClusterKind::Compose { - project: None, - services, + project: Some(project), + services: Vec::new(), }, } } #[must_use] - #[doc(hidden)] - pub fn compose_in_project(services: Vec, project: String) -> Self { + pub fn for_compose_services(project: String, services: Vec) -> Self { Self { kind: ExistingClusterKind::Compose { project: Some(project), diff --git a/testing-framework/deployers/compose/src/deployer/mod.rs b/testing-framework/deployers/compose/src/deployer/mod.rs index 2eab7c6..a0c35d5 100644 --- a/testing-framework/deployers/compose/src/deployer/mod.rs +++ b/testing-framework/deployers/compose/src/deployer/mod.rs @@ -66,8 +66,7 @@ impl ComposeDeploymentMetadata { .project_name() .ok_or(ComposeMetadataError::MissingProjectName)?; - Ok(ExistingCluster::compose_in_project( - Vec::new(), + Ok(ExistingCluster::for_compose_project( project_name.to_owned(), )) } @@ -81,9 +80,9 @@ impl ComposeDeploymentMetadata { .project_name() .ok_or(ComposeMetadataError::MissingProjectName)?; - Ok(ExistingCluster::compose_in_project( - services, + Ok(ExistingCluster::for_compose_services( project_name.to_owned(), + services, )) } diff --git a/testing-framework/deployers/k8s/src/deployer/mod.rs b/testing-framework/deployers/k8s/src/deployer/mod.rs index e20fcc5..d97615b 100644 --- a/testing-framework/deployers/k8s/src/deployer/mod.rs +++ b/testing-framework/deployers/k8s/src/deployer/mod.rs @@ -53,9 +53,9 @@ impl K8sDeploymentMetadata { .label_selector() .ok_or(K8sMetadataError::MissingLabelSelector)?; - Ok(ExistingCluster::k8s_in_namespace( - label_selector.to_owned(), + Ok(ExistingCluster::for_k8s_selector_in_namespace( namespace.to_owned(), + label_selector.to_owned(), )) }