Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jan 24, 2025
1 parent 0885e7a commit 9ead1e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
3 changes: 2 additions & 1 deletion crates/remote/src/fs_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use bazel_remote_apis::build::bazel::remote::execution::v2::{
Digest, NodeProperties, OutputDirectory, OutputFile, OutputSymlink,
};
use bazel_remote_apis::google::protobuf::{Timestamp, UInt32Value};
use bazel_remote_apis::google::protobuf::Timestamp;
use chrono::NaiveDateTime;
use moon_common::path::{PathExt, WorkspaceRelativePathBuf};
use sha2::{Digest as Sha256Digest, Sha256};
Expand Down Expand Up @@ -76,6 +76,7 @@ pub fn compute_node_properties(metadata: &Metadata) -> NodeProperties {

#[cfg(unix)]
{
use bazel_remote_apis::google::protobuf::UInt32Value;
use std::os::unix::fs::PermissionsExt;

props.unix_mode = Some(UInt32Value {
Expand Down
2 changes: 0 additions & 2 deletions crates/remote/src/grpc_remote_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ use tonic::{
use tracing::{trace, warn};

fn map_transport_error(error: tonic::transport::Error) -> RemoteError {
dbg!(&error);
RemoteError::GrpcConnectFailed {
error: Box::new(error),
}
}

fn map_status_error(error: tonic::Status) -> RemoteError {
dbg!(&error);
RemoteError::GrpcCallFailed {
error: Box::new(error),
}
Expand Down
6 changes: 4 additions & 2 deletions crates/remote/src/remote_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ impl RemoteService {
Some(cap.max_batch_total_size_bytes)
}
})
// grpc limit: 4mb - buffer
.unwrap_or(4194304 - (1024 * 10))
// grpc limit: 4mb
.unwrap_or(4194304)
// Minus a small buffer
- 1024
}

#[instrument(skip(self, state))]
Expand Down
21 changes: 3 additions & 18 deletions crates/task-runner/tests/task_runner_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,7 @@ mod task_runner {
runner.execute(&context, &node).await.unwrap();

assert_eq!(
context
.target_states
.get(&runner.task.target)
.unwrap()
.get(),
runner.target_state.as_ref().unwrap(),
&TargetState::Passed("hash123".into())
);
}
Expand All @@ -747,11 +743,7 @@ mod task_runner {
runner.execute(&context, &node).await.unwrap();

assert_eq!(
context
.target_states
.get(&runner.task.target)
.unwrap()
.get(),
runner.target_state.as_ref().unwrap(),
&TargetState::Passthrough
);
}
Expand All @@ -770,14 +762,7 @@ mod task_runner {
// Swallow panic so we can check operations
let _ = runner.execute(&context, &node).await;

assert_eq!(
context
.target_states
.get(&runner.task.target)
.unwrap()
.get(),
&TargetState::Failed
);
assert_eq!(runner.target_state.as_ref().unwrap(), &TargetState::Failed);
}

#[tokio::test]
Expand Down

0 comments on commit 9ead1e0

Please sign in to comment.