Skip to content
Draft

DNM #969

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
3 changes: 2 additions & 1 deletion orb-jobs-agent/tests/change_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async fn it_changes_name_successfully() {
assert_eq!(contents, "test-orb");

let result = fx.execution_updates.map_iter(|x| x.std_out).await;
assert!(!result.is_empty(), "Expected at least one update");
assert!(result[0].contains("test-orb"));
}

Expand All @@ -41,7 +42,6 @@ async fn it_validates_dash_requirement() {
// Arrange
let temp_file = TempFile::new().await.unwrap();
let filepath = temp_file.file_path().to_path_buf();
fs::remove_file(&filepath).await.ok();

let mut fx = JobAgentFixture::new().await;
fx.settings.orb_name_path = filepath.clone();
Expand All @@ -55,5 +55,6 @@ async fn it_validates_dash_requirement() {

// Assert
let status = fx.execution_updates.map_iter(|x| x.status).await;
assert!(!status.is_empty(), "Expected at least one update");
assert_eq!(status.last().unwrap(), &(JobExecutionStatus::Failed as i32));
}
21 changes: 21 additions & 0 deletions orb-jobs-agent/tests/common/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,27 @@ impl JobAgentFixture {
.await
.unwrap();
}

pub async fn wait_for_updates(&self, expected_count: usize) {
let start = tokio::time::Instant::now();
let timeout = Duration::from_secs(5);

loop {
let count = self.execution_updates.lock().await.len();
if count >= expected_count {
return;
}

if start.elapsed() > timeout {
panic!(
"Timeout waiting for {} updates, only got {}",
expected_count, count
);
}

tokio::time::sleep(Duration::from_millis(10)).await;
}
}
}

pub struct ProgramHandle {
Expand Down
Loading
Loading