Skip to content

Commit

Permalink
chore(deps): remove spectral from dev-dependencies (#526)
Browse files Browse the repository at this point in the history
`spectral` is outdated (last update >7 years ago), it causes warning:

```
the following packages contain code that will be rejected by a future version of Rust: rustc-serialize v0.3.24
```

And actually there is no need in it
  • Loading branch information
DDtKey authored Sep 28, 2023
1 parent 8c89718 commit 942261e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
1 change: 0 additions & 1 deletion testcontainers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ experimental = [ "async-trait", "bollard", "tokio" ]
[dev-dependencies]
pretty_env_logger = "0.5"
reqwest = { version = "0.11.14", features = [ "blocking" ] }
spectral = "0.6.0"
testimages = { path = "../testimages" }
tokio = { version = "1", features = [ "macros" ] }
12 changes: 9 additions & 3 deletions testcontainers/src/clients/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ impl Drop for Client {
mod tests {
use super::*;
use crate::{core::WaitFor, images::generic::GenericImage, Image};
use spectral::prelude::*;
use std::collections::BTreeMap;

#[derive(Default)]
Expand Down Expand Up @@ -702,7 +701,14 @@ mod tests {
docker.stdout_logs(container.id());
let after_logs = Instant::now();

assert_that(&(after_run - before_run)).is_greater_than(Duration::from_secs(1));
assert_that(&(after_logs - before_logs)).is_less_than(Duration::from_secs(1));
const ONE_SEC: Duration = Duration::from_secs(1);
assert!(
(after_run - before_run) > ONE_SEC,
"run completed in less than a second"
);
assert!(
(after_logs - before_logs) < ONE_SEC,
"log fetching took more than a second"
);
}
}
16 changes: 10 additions & 6 deletions testcontainers/src/clients/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ impl DockerAsync for Http {
mod tests {
use super::*;
use crate::images::generic::GenericImage;
use spectral::prelude::*;

async fn inspect(client: &bollard::Docker, id: &str) -> ContainerInspectResponse {
client.inspect_container(id, None).await.unwrap()
Expand All @@ -365,8 +364,12 @@ mod tests {

// inspect volume and env
let container_details = inspect(&docker.inner.bollard, container.id()).await;
assert_that!(container_details.host_config.unwrap().publish_all_ports)
.is_equal_to(Some(true));
let publish_ports = container_details
.host_config
.unwrap()
.publish_all_ports
.unwrap();
assert_eq!(publish_ports, true, "publish_all_ports must be `true`");
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -385,8 +388,8 @@ mod tests {
.unwrap()
.port_bindings
.unwrap();
assert_that!(&port_bindings).contains_key(&"456/tcp".into());
assert_that!(&port_bindings).contains_key(&"888/tcp".into());
assert!(port_bindings.contains_key("456/tcp"));
assert!(port_bindings.contains_key("888/tcp"));
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -417,7 +420,8 @@ mod tests {
let container = docker.run(image).await;

let container_details = inspect(&docker.inner.bollard, container.id()).await;
assert_that!(container_details.name.unwrap()).ends_with("hello_container");
let container_name = container_details.name.unwrap();
assert!(container_name.ends_with("hello_container"));
}

#[tokio::test(flavor = "multi_thread")]
Expand Down

0 comments on commit 942261e

Please sign in to comment.