mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-03-31 08:13:48 +00:00
Name existing cluster semantics explicitly
This commit is contained in:
parent
eeb0573798
commit
05b907d8ef
@ -23,7 +23,7 @@ async fn compose_attach_mode_queries_node_api_opt_in() -> Result<()> {
|
||||
let attach_source = metadata.attach_source().map_err(|err| anyhow!("{err}"))?;
|
||||
let attached = ScenarioBuilder::deployment_with(|d| d.with_node_count(1))
|
||||
.with_run_duration(Duration::from_secs(5))
|
||||
.with_attach_source(attach_source)
|
||||
.with_existing_cluster(attach_source)
|
||||
.build()?;
|
||||
|
||||
let attached_deployer = LbcComposeDeployer::default();
|
||||
|
||||
@ -23,7 +23,7 @@ async fn k8s_attach_mode_queries_node_api_opt_in() -> Result<()> {
|
||||
let attach_source = metadata.attach_source().map_err(|err| anyhow!("{err}"))?;
|
||||
let attached = ScenarioBuilder::deployment_with(|d| d.with_node_count(1))
|
||||
.with_run_duration(Duration::from_secs(5))
|
||||
.with_attach_source(attach_source)
|
||||
.with_existing_cluster(attach_source)
|
||||
.build()?;
|
||||
|
||||
let attached_deployer = LbcK8sDeployer::default();
|
||||
|
||||
@ -118,8 +118,14 @@ impl<E: Application, Caps> Scenario<E, Caps> {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn existing_cluster(&self) -> Option<&AttachSource> {
|
||||
self.sources.existing_cluster()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[doc(hidden)]
|
||||
pub fn attached_source(&self) -> Option<&AttachSource> {
|
||||
self.sources.attached_source()
|
||||
self.existing_cluster()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@ -243,8 +249,14 @@ macro_rules! impl_common_builder_methods {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_existing_cluster(self, cluster: AttachSource) -> Self {
|
||||
self.map_core_builder(|builder| builder.with_existing_cluster(cluster))
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[doc(hidden)]
|
||||
pub fn with_attach_source(self, attach: AttachSource) -> Self {
|
||||
self.map_core_builder(|builder| builder.with_attach_source(attach))
|
||||
self.with_existing_cluster(attach)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@ -556,11 +568,17 @@ impl<E: Application, Caps> Builder<E, Caps> {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_attach_source(mut self, attach: AttachSource) -> Self {
|
||||
self.sources = self.sources.with_attach(attach);
|
||||
pub fn with_existing_cluster(mut self, cluster: AttachSource) -> Self {
|
||||
self.sources = self.sources.with_attach(cluster);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[doc(hidden)]
|
||||
pub fn with_attach_source(self, attach: AttachSource) -> Self {
|
||||
self.with_existing_cluster(attach)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_node(mut self, node: ExternalNodeSource) -> Self {
|
||||
self.sources = self.sources.with_external_node(node);
|
||||
|
||||
@ -173,7 +173,7 @@ impl ScenarioSources {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn attached_source(&self) -> Option<&AttachSource> {
|
||||
pub fn existing_cluster(&self) -> Option<&AttachSource> {
|
||||
match self {
|
||||
Self::Attached { attach, .. } => Some(attach),
|
||||
Self::Managed { .. } | Self::ExternalOnly { .. } => None,
|
||||
@ -199,6 +199,11 @@ impl ScenarioSources {
|
||||
matches!(self, Self::Attached { .. })
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn uses_existing_cluster(&self) -> bool {
|
||||
self.is_attached()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn is_external_only(&self) -> bool {
|
||||
matches!(self, Self::ExternalOnly { .. })
|
||||
|
||||
@ -71,7 +71,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
|
||||
}
|
||||
})?;
|
||||
|
||||
if scenario.sources().is_attached() {
|
||||
if scenario.sources().uses_existing_cluster() {
|
||||
return self
|
||||
.deploy_attached_only::<Caps>(scenario, source_plan)
|
||||
.await
|
||||
@ -215,7 +215,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
|
||||
}
|
||||
|
||||
let attach = scenario
|
||||
.attached_source()
|
||||
.existing_cluster()
|
||||
.ok_or(ComposeRunnerError::InternalInvariant {
|
||||
message: "attached node control requested outside attached source mode",
|
||||
})?;
|
||||
@ -243,7 +243,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
|
||||
Caps: Send + Sync,
|
||||
{
|
||||
let attach = scenario
|
||||
.attached_source()
|
||||
.existing_cluster()
|
||||
.ok_or(ComposeRunnerError::InternalInvariant {
|
||||
message: "compose attached cluster wait requested outside attached source mode",
|
||||
})?;
|
||||
@ -373,7 +373,7 @@ where
|
||||
Caps: Send + Sync,
|
||||
{
|
||||
let project_name = scenario
|
||||
.attached_source()
|
||||
.existing_cluster()
|
||||
.and_then(|attach| attach.compose_project())
|
||||
.map(ToOwned::to_owned);
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ where
|
||||
|
||||
let observability = resolve_observability_inputs(scenario.capabilities())?;
|
||||
|
||||
if scenario.sources().is_attached() {
|
||||
if scenario.sources().uses_existing_cluster() {
|
||||
let runner = deploy_attached_only::<E, Caps>(scenario, source_plan, observability).await?;
|
||||
return Ok((runner, attached_metadata(scenario)));
|
||||
}
|
||||
@ -250,11 +250,11 @@ where
|
||||
Caps: Send + Sync,
|
||||
{
|
||||
let namespace = scenario
|
||||
.attached_source()
|
||||
.existing_cluster()
|
||||
.and_then(|attach| attach.k8s_namespace())
|
||||
.map(ToOwned::to_owned);
|
||||
let label_selector = scenario
|
||||
.attached_source()
|
||||
.existing_cluster()
|
||||
.and_then(|attach| attach.k8s_label_selector())
|
||||
.map(ToOwned::to_owned);
|
||||
|
||||
@ -273,7 +273,7 @@ where
|
||||
Caps: Send + Sync,
|
||||
{
|
||||
let attach = scenario
|
||||
.attached_source()
|
||||
.existing_cluster()
|
||||
.ok_or_else(|| K8sRunnerError::InternalInvariant {
|
||||
message: "k8s attached cluster wait requested outside attached source mode".to_owned(),
|
||||
})?;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user