Skip to content
Draft
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
14 changes: 13 additions & 1 deletion rs/tests/driver/src/driver/vector_logging_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ pub(crate) fn vector_logging_task(group_ctx: GroupContext, start_time: DateTime<
}

let mut vector_vm = VectorVm::new().with_start_time(start_time);
vector_vm.start(&env).expect("Failed to start Vector VM");
// This task supervises the whole test plan, so failing (or panicking) here
// would fail the entire test run just because the log-shipping VM could
// not be provisioned. Finishing normally, in contrast, has no effect on
// the supervised tasks. Vector only ships logs to Elasticsearch, so
// continue without it and let the logs be fetched from the nodes directly
// if needed.
if let Err(e) = vector_vm.start(&env) {
warn!(
logger,
"Failed to start Vector VM: {:?}. Continuing the run without vector logging.", e
);
return;
}

loop {
if let Err(e) = vector_vm.sync_with_vector(&env) {
Expand Down
13 changes: 9 additions & 4 deletions rs/tests/driver/src/driver/vector_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
path::Path,
};

use anyhow::Context;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize, Serializer, ser::SerializeStruct};
use slog::{Logger, debug, info, warn};
Expand Down Expand Up @@ -265,10 +266,14 @@ impl VectorVm {
return Ok(());
};

let deployed_vm = env.get_deployed_universal_vm("vector").unwrap();
// Return errors instead of panicking: this runs in the vector_logging
// task which supervises the whole test plan, so a panic here would fail
// the entire test run just because the log-shipping VM is unreachable.
// The caller (the loop in `vector_logging_task`) warns and retries.
let deployed_vm = env.get_deployed_universal_vm("vector")?;
let session = deployed_vm
.block_on_ssh_session()
.unwrap_or_else(|e| panic!("Failed to setup SSH session to vector because: {e:?}!",));
.context("Failed to setup SSH session to vector")?;

std::fs::write(
vector_local_dir.join("generated_config.json"),
Expand Down Expand Up @@ -309,15 +314,15 @@ docker run -d --name vector \
"#,
),
)
.unwrap();
.context("Failed to run vector container")?;
self.container_running = true;

emit_kibana_url_event(&log, &infra_group_name, &self.start_time);
} else {
info!(log, "Issuing command to reload vector configuration.");
deployed_vm
.block_on_bash_script_from_session(&session, "docker kill --signal=HUP vector")
.unwrap();
.context("Failed to reload vector configuration")?;
}

info!(log, "Vector targets sync complete.");
Expand Down
Loading