Skip to content

Commit

Permalink
Drop support for ABQ statefiles (#33)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Glass <[email protected]>
  • Loading branch information
ayazhafiz and michaelglass committed Jul 5, 2023
1 parent 4102694 commit 74daf2f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 120 deletions.
3 changes: 0 additions & 3 deletions crates/abq_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod health;
mod instance;
mod report;
mod reporting;
mod statefile;
mod workers;

use std::io;
Expand Down Expand Up @@ -436,8 +435,6 @@ async fn abq_main() -> anyhow::Result<ExitCode> {
_ => ExecutionMode::WriteNormal,
};

statefile::optional_write_worker_statefile(&run_id)?;

let runner = RunnerKind::GenericNativeTestRunner(runner_params);

let max_run_number = 1 + retries;
Expand Down
45 changes: 0 additions & 45 deletions crates/abq_cli/src/statefile.rs

This file was deleted.

72 changes: 0 additions & 72 deletions crates/abq_cli/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use mockito::{Matcher, Server};
use regex::Regex;
use serde_json as json;
use serial_test::serial;
use std::fs::File;
use std::ops::{Deref, DerefMut};
use std::process::{ChildStderr, ChildStdout, ExitStatus, Output};
use std::str::FromStr;
Expand Down Expand Up @@ -1181,77 +1180,6 @@ test_all_network_config_options! {
}
}

fn verify_and_sanitize_state(state: &mut json::Map<String, json::Value>) {
{
let exe_cell = state
.get_mut("abq_executable")
.expect("abq_executable missing");
let exe_path = Path::new(exe_cell.as_str().unwrap());
assert_eq!(exe_path, abq_binary());
*exe_cell = json::json!("<replaced abq.exe>");
}

{
let version_cell = state.get_mut("abq_version").expect("abq_version missing");
assert_eq!(version_cell.as_str().unwrap(), abq_utils::VERSION);
*version_cell = json::json!("<replaced ABQ version>");
}
}

#[test]
fn write_statefile_for_worker() {
let name = "write_statefile_for_worker";
let conf = CSConfigOptions {
use_auth_token: false,
tls: false,
};

let statefile = tempfile::NamedTempFile::new().unwrap().into_temp_path();
let statefile = statefile.to_path_buf();

let (queue_proc, queue_addr) = setup_queue!(name, conf);

let test_args = |worker: usize| {
vec![
format!("test"),
format!("--worker={worker}"),
format!("--reporter=dot"),
format!("--queue-addr={queue_addr}"),
format!("--working-dir=."),
format!("--run-id=my-test-run-id"),
format!("--num=cpu-cores"),
format!("--color=never"),
format!("--"),
format!("__zzz_not_a_command__"),
]
};

let mut worker0 = Abq::new("write_statefile_for_worker0")
.args(test_args(0))
.spawn();

let _worker1 = Abq::new("write_statefile_for_worker0")
.args(test_args(1))
.env([("ABQ_STATE_FILE", statefile.display().to_string())])
.run();

worker0.kill().unwrap();
term(queue_proc);

let statefile = File::open(&statefile).unwrap();
let mut state = serde_json::from_reader(&statefile).unwrap();

verify_and_sanitize_state(&mut state);

insta::assert_json_snapshot!(state, @r###"
{
"abq_executable": "<replaced abq.exe>",
"abq_version": "<replaced ABQ version>",
"run_id": "my-test-run-id"
}
"###);
}

test_all_network_config_options! {
native_runner_fails_while_executing_test |name, conf: CSConfigOptions| {
let (queue_proc, queue_addr) = setup_queue!(name, conf);
Expand Down

0 comments on commit 74daf2f

Please sign in to comment.