mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-02 13:23:13 +00:00
refactor(compose-runner): name timeouts for compose port/restart
This commit is contained in:
parent
7891bc0be3
commit
b7e8821a23
@ -1,4 +1,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use testing_framework_core::scenario::{DynError, NodeControlHandle};
|
||||
use tokio::process::Command;
|
||||
@ -6,6 +9,8 @@ use tracing::info;
|
||||
|
||||
use crate::{docker::commands::run_docker_command, errors::ComposeRunnerError};
|
||||
|
||||
const COMPOSE_RESTART_TIMEOUT: Duration = Duration::from_secs(120);
|
||||
|
||||
pub async fn restart_compose_service(
|
||||
compose_file: &Path,
|
||||
project_name: &str,
|
||||
@ -25,7 +30,7 @@ pub async fn restart_compose_service(
|
||||
info!(service, project = project_name, compose_file = %compose_file.display(), "restarting compose service");
|
||||
run_docker_command(
|
||||
command,
|
||||
testing_framework_core::adjust_timeout(std::time::Duration::from_secs(120)),
|
||||
testing_framework_core::adjust_timeout(COMPOSE_RESTART_TIMEOUT),
|
||||
description,
|
||||
)
|
||||
.await
|
||||
|
||||
@ -31,6 +31,7 @@ use crate::{
|
||||
};
|
||||
|
||||
const CFGSYNC_START_TIMEOUT: Duration = Duration::from_secs(180);
|
||||
const COMPOSE_PORT_DISCOVERY_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
const STACK_BRINGUP_MAX_ATTEMPTS: usize = 3;
|
||||
|
||||
/// Paths and flags describing the prepared compose workspace.
|
||||
@ -531,7 +532,7 @@ async fn resolve_service_port(
|
||||
.arg(container_port.to_string())
|
||||
.current_dir(root);
|
||||
|
||||
let output = timeout(adjust_timeout(Duration::from_secs(30)), cmd.output())
|
||||
let output = timeout(adjust_timeout(COMPOSE_PORT_DISCOVERY_TIMEOUT), cmd.output())
|
||||
.await
|
||||
.map_err(|_| ComposeRunnerError::PortDiscovery {
|
||||
service: service.to_owned(),
|
||||
|
||||
@ -16,6 +16,8 @@ use crate::{
|
||||
infrastructure::environment::StackEnvironment,
|
||||
};
|
||||
|
||||
const COMPOSE_PORT_DISCOVERY_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
|
||||
/// Host ports mapped for a single node.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct NodeHostPorts {
|
||||
@ -100,7 +102,7 @@ async fn resolve_service_port(
|
||||
.arg(container_port.to_string())
|
||||
.current_dir(environment.root());
|
||||
|
||||
let output = timeout(adjust_timeout(Duration::from_secs(30)), cmd.output())
|
||||
let output = timeout(adjust_timeout(COMPOSE_PORT_DISCOVERY_TIMEOUT), cmd.output())
|
||||
.await
|
||||
.map_err(|_| ComposeRunnerError::PortDiscovery {
|
||||
service: service.to_owned(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user