Skip to content

Commit f52cd14

Browse files
authored
[rust/rqd] Ensure dummy-cuebot is built before running rqd integration tests (#1863)
Integration tests are failing on some environment when the compilation order puts dummy-cuebot after rqd.
1 parent 400b353 commit f52cd14

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

rust/Cargo.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[workspace]
22
members = ["crates/opencue-proto", "crates/rqd", "crates/dummy-cuebot"]
3+
resolver = "3"
34

45
[workspace.package]
56
authors = ["Diego Tavares <[email protected]>"]
67
edition = "2024"
7-
resolver = "3"
8-
version = "0.1.0"
8+
version = "0.1.3"
99

1010
[workspace.dependencies]
1111
async-trait = "0.1"

rust/crates/rqd/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ libc = "0.2"
6464
device_query = "3.0"
6565

6666
[dev-dependencies]
67-
dummy-cuebot = { path = "../dummy-cuebot" }
6867
tempfile = "3.14.0"
6968

7069
# === Rpm configuration ===

rust/crates/rqd/tests/rqd_integration_tests.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
11
use std::io::{BufRead, BufReader};
22
use std::process::{Command, Stdio};
3+
use std::sync::Once;
34
use std::thread;
45
use std::time::Duration;
56
use tempfile::TempDir;
67
use tokio::time::sleep;
78

9+
static INIT: Once = Once::new();
10+
11+
/// Ensure dummy-cuebot is built before running tests
12+
fn ensure_dummy_cuebot_built() {
13+
INIT.call_once(|| {
14+
println!("Building dummy-cuebot binary for tests...");
15+
let output = Command::new("cargo")
16+
.args(["build", "-p", "dummy-cuebot", "-r"])
17+
.current_dir("../../") // Go to workspace root
18+
.output()
19+
.expect("Failed to execute cargo build for dummy-cuebot");
20+
21+
if !output.status.success() {
22+
panic!(
23+
"Failed to build dummy-cuebot: {}",
24+
String::from_utf8_lossy(&output.stderr)
25+
);
26+
}
27+
println!("Successfully built dummy-cuebot binary");
28+
});
29+
}
30+
831
/// Helper function to determine the correct binary path based on build profile
932
fn get_binary_path(binary_name: &str) -> String {
33+
ensure_dummy_cuebot_built();
34+
1035
// Check if we're running in debug or release mode by looking for the binaries
1136
let release_path = format!("../../target/release/{}", binary_name);
1237
let debug_path = format!("../../target/debug/{}", binary_name);
13-
38+
1439
// First check if release binary exists
1540
if std::path::Path::new(&release_path).exists() {
1641
release_path

0 commit comments

Comments
 (0)