Skip to content

Commit

Permalink
Get rid of spectral rust crate. (pantsbuild#18774)
Browse files Browse the repository at this point in the history
This get rids of a bunch of packages we don't really need (num-*) and
one package
[rustc-serialize](https://github.com/rust-lang-deprecated/rustc-serialize)
which was deprecated

from what I can tell, this package was added ~4 years ago... my guess
back then, rust was missing some of the testing features that it
provided, I think this is no longer the case.
  • Loading branch information
asherf authored Apr 20, 2023
1 parent 3a8bf22 commit 1aca349
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 150 deletions.
143 changes: 11 additions & 132 deletions src/rust/engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/rust/engine/process_execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ maplit = "1.0.1"
mock = { path = "../testutil/mock" }
parking_lot = "0.12"
sharded_lmdb = { path = "../sharded_lmdb" }
spectral = "0.6.0"
tempfile = "3"
testutil = { path = "../testutil" }
tokio = { version = "1.21", features = ["macros"] }
1 change: 0 additions & 1 deletion src/rust/engine/process_execution/docker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ maplit = "1.0.1"
mock = { path = "../../testutil/mock" }
parking_lot = "0.12"
sharded_lmdb = { path = "../../sharded_lmdb" }
spectral = "0.6.0"
tempfile = "3"
testutil = { path = "../../testutil" }
tokio = { version = "1.21", features = ["macros"] }
8 changes: 3 additions & 5 deletions src/rust/engine/process_execution/docker/src/docker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use std::time::Duration;
use bollard::Docker;
use fs::{RelativePath, EMPTY_DIRECTORY_DIGEST};
use maplit::hashset;
use spectral::assert_that;
use spectral::string::StrAssertions;
use store::{ImmutableInputs, Store};
use tempfile::TempDir;
use testutil::data::{TestData, TestDirectory};
Expand Down Expand Up @@ -605,9 +603,9 @@ async fn timeout() {
assert_eq!(result.original.exit_code, -15);
let stdout = String::from_utf8(result.stdout_bytes.to_vec()).unwrap();
let stderr = String::from_utf8(result.stderr_bytes.to_vec()).unwrap();
assert_that(&stdout).contains("Calculating...");
assert_that(&stderr).contains("Exceeded timeout");
assert_that(&stderr).contains("sleepy-cat");
assert!(&stdout.contains("Calculating..."));
assert!(&stderr.contains("Exceeded timeout"));
assert!(&stderr.contains("sleepy-cat"));
}

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
Expand Down
1 change: 0 additions & 1 deletion src/rust/engine/process_execution/pe_nailgun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ maplit = "1.0.1"
mock = { path = "../../testutil/mock" }
parking_lot = "0.12"
sharded_lmdb = { path = "../../sharded_lmdb" }
spectral = "0.6.0"
tempfile = "3"
testutil = { path = "../../testutil" }
tokio = { version = "1.21", features = ["macros"] }
Expand Down
1 change: 0 additions & 1 deletion src/rust/engine/process_execution/remote/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ maplit = "1.0.1"
mock = { path = "../../testutil/mock" }
parking_lot = "0.12"
sharded_lmdb = { path = "../../sharded_lmdb" }
spectral = "0.6.0"
tempfile = "3"
testutil = { path = "../../testutil" }
tokio = { version = "1.21", features = ["macros"] }
8 changes: 3 additions & 5 deletions src/rust/engine/process_execution/remote/src/remote_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use prost::Message;
use protos::gen::build::bazel::remote::execution::v2 as remexec;
use protos::gen::google::longrunning::Operation;
use remexec::{execution_stage::Value as ExecutionStageValue, ExecutedActionMetadata};
use spectral::prelude::*;
use spectral::{assert_that, string::StrAssertions};
use store::{SnapshotOps, Store, StoreError};
use tempfile::TempDir;
use testutil::data::{TestData, TestDirectory, TestTree};
Expand Down Expand Up @@ -1224,8 +1222,8 @@ async fn server_rejecting_execute_request_gives_error() {
let error = run_command_remote(mock_server.address(), execute_request)
.await
.expect_err("Want Err");
assert_that(&error.to_string()).contains("InvalidArgument");
assert_that(&error.to_string()).contains("Did not expect this request");
assert!(&error.to_string().contains("InvalidArgument"));
assert!(&error.to_string().contains("Did not expect this request"));
}

#[tokio::test]
Expand Down Expand Up @@ -1343,7 +1341,7 @@ async fn sends_headers() {
.iter()
.map(|received_message| received_message.headers.clone())
.collect();
assert_that!(message_headers).has_length(1);
assert_eq!(message_headers.len(), 1);
for headers in message_headers {
{
let want_key = "google.devtools.remoteexecution.v1test.requestmetadata-bin";
Expand Down
7 changes: 3 additions & 4 deletions src/rust/engine/process_execution/src/local_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::time::Duration;

use maplit::hashset;
use shell_quote::bash;
use spectral::{assert_that, string::StrAssertions};
use tempfile::TempDir;

use fs::EMPTY_DIRECTORY_DIGEST;
Expand Down Expand Up @@ -568,9 +567,9 @@ async fn timeout() {
assert_eq!(result.original.exit_code, -15);
let stdout = String::from_utf8(result.stdout_bytes.to_vec()).unwrap();
let stderr = String::from_utf8(result.stderr_bytes.to_vec()).unwrap();
assert_that(&stdout).contains("Calculating...");
assert_that(&stderr).contains("Exceeded timeout");
assert_that(&stderr).contains("sleepy-cat");
assert!(&stdout.contains("Calculating..."));
assert!(&stderr.contains("Exceeded timeout"));
assert!(&stderr.contains("sleepy-cat"));
}

#[tokio::test]
Expand Down

0 comments on commit 1aca349

Please sign in to comment.