Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Continuous integration
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
MSRV: 1.70.0
MSRV: 1.71.1

jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion rustainers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description = "A simple, opinionated way to run containers for tests."
readme = "README.md"
repository = "https://github.com/wefoxplatform/rustainers"

rust-version = "1.70.0" # toml_datetime
rust-version = "1.71.1" # litemap

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions rustainers/src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<'a> Cmd<'a> {
}

// Blocking API
impl<'a> Cmd<'a> {
impl Cmd<'_> {
fn output_blocking(&self) -> Result<Output, CommandError> {
debug!("Running blocking command\n{self}");
let mut cmd: std::process::Command = std::process::Command::new(self.command);
Expand Down Expand Up @@ -141,7 +141,7 @@ impl<'a> Cmd<'a> {
}

// Async API
impl<'a> Cmd<'a> {
impl Cmd<'_> {
async fn output(&self) -> Result<Output, CommandError> {
debug!("Running command\n{self}");
let mut cmd = tokio::process::Command::new(self.command);
Expand Down Expand Up @@ -226,7 +226,7 @@ pub(crate) fn escape_arg(arg: &str) -> Cow<'_, str> {
}
}

impl<'a> Display for Cmd<'a> {
impl Display for Cmd<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.command)?;
for arg in &self.args {
Expand Down
2 changes: 1 addition & 1 deletion rustainers/src/container/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ mod serde_ip {
}

struct IpVisitor;
impl<'de> Visitor<'de> for IpVisitor {
impl Visitor<'_> for IpVisitor {
type Value = Ip;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion rustainers/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ mod image_id_serde {

struct IdVisitor;

impl<'de> Visitor<'de> for IdVisitor {
impl Visitor<'_> for IdVisitor {
type Value = Id;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
6 changes: 3 additions & 3 deletions rustainers/src/images/minio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ impl Minio {
impl Minio {
/// The region
#[must_use]
pub fn region(&self) -> &str {
pub fn region(&self) -> &'static str {
"us-east-1"
}

/// The access key id
#[must_use]
pub fn access_key_id(&self) -> &str {
pub fn access_key_id(&self) -> &'static str {
"minioadmin"
}

/// The secret access key
#[must_use]
pub fn secret_access_key(&self) -> &str {
pub fn secret_access_key(&self) -> &'static str {
"minioadmin"
}
}
Expand Down
2 changes: 1 addition & 1 deletion rustainers/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ mod serde_version {

struct VersionVisitor;

impl<'de> Visitor<'de> for VersionVisitor {
impl Visitor<'_> for VersionVisitor {
type Value = Version;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
13 changes: 8 additions & 5 deletions rustainers/tests/common/images.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Common test images.

use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::process::Command;

Expand All @@ -7,7 +9,7 @@ use rustainers::{
RunnableContainerBuilder, ToRunnableContainer, WaitStrategy,
};

// A web server only accessible when sharing the same network
/// A web server only accessible when sharing the same network
#[derive(Debug)]
pub struct InternalWebServer;

Expand All @@ -24,9 +26,10 @@ impl ToRunnableContainer for InternalWebServer {
}
}

// Curl
/// Curl image.
#[derive(Debug)]
pub struct Curl {
/// URL to be checked.
pub url: String,
}

Expand Down Expand Up @@ -57,7 +60,7 @@ impl ToRunnableContainer for Curl {
}
}

// A web server accessible from host
/// A web server accessible from host
#[derive(Debug)]
pub struct WebServer(ExposedPort);

Expand All @@ -78,7 +81,7 @@ impl ToRunnableContainer for WebServer {
}

impl WebServer {
// Container path that contains the static HTML pages
/// Container path that contains the static HTML pages
pub const STATIC_HTML: &'static str = "/usr/share/nginx/html";

/// Get the text content
Expand All @@ -95,7 +98,7 @@ impl WebServer {
}
}

// Netcat
/// Netcat
#[derive(Debug)]
pub struct Netcat(ExposedPort);

Expand Down
5 changes: 4 additions & 1 deletion rustainers/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Common functions.

use rstest::fixture;
use tracing::{debug, Level};
use tracing_subscriber::fmt::format::FmtSpan;
Expand All @@ -7,6 +9,7 @@ use rustainers::runner::Runner;

pub mod images;

/// Initializes tracing in tests.
pub fn init_test_tracing(level: Level) {
tracing_subscriber::fmt()
.pretty()
Expand All @@ -21,7 +24,7 @@ pub fn init_test_tracing(level: Level) {

#[fixture]
#[once]
pub fn runner() -> Runner {
pub(crate) fn runner() -> Runner {
init_test_tracing(Level::INFO);

let runner = if cfg!(feature = "ensure-podman") {
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/compose_images.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Compose images.

mod common;
pub use self::common::*;

Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/custom.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Custom container tests.

use assert2::let_assert;
use rstest::rstest;

Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/env.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Envorinment variable tests.

use std::collections::HashMap;

use assert2::check;
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/images.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Contains test images.

#![allow(clippy::expect_used)]

use std::time::SystemTime;
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/network.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Network-related tests.

use assert2::let_assert;
use rstest::rstest;
use rustainers::runner::{RunOption, Runner};
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/tools.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tools for tests.

use assert2::let_assert;
use rstest::rstest;
use ulid::Ulid;
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/volume.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Container volume tests.

use assert2::{check, let_assert};
use rstest::rstest;
use ulid::Ulid;
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/wait-logs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests for log waits.

use std::time::{Duration, Instant};

use assert2::check;
Expand Down
2 changes: 2 additions & 0 deletions rustainers/tests/waits.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests for waits.

mod common;
use assert2::let_assert;
use rstest::rstest;
Expand Down
Loading