1
0
Fork 0
forked from matteo/serves3

chore: update dependencies to latest versions

This commit is contained in:
Matteo Settenvini 2024-09-28 03:08:08 +02:00
parent e3aca4fe72
commit 373b141346
7 changed files with 761 additions and 932 deletions

View file

@ -1,31 +1,47 @@
// SPDX-FileCopyrightText: © Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
// SPDX-License-Identifier: EUPL-1.2
use {testcontainers::core::WaitFor, testcontainers::Image, testcontainers_modules::minio};
use {
delegate::delegate,
std::borrow::Cow,
testcontainers::{
core::{ContainerPort, WaitFor},
Image,
},
testcontainers_modules::minio,
};
const MINIO_IMAGE_TAG: &'static str = "RELEASE.2024-05-28T17-19-04Z";
const MINIO_IMAGE_TAG: &'static str = "RELEASE.2024-09-22T00-33-43Z";
pub struct MinIO {
inner: minio::MinIO,
}
impl Image for MinIO {
type Args = minio::MinIOServerArgs;
fn name(&self) -> String {
self.inner.name()
fn tag(&self) -> &str {
MINIO_IMAGE_TAG.into()
}
fn ready_conditions(&self) -> Vec<WaitFor> {
vec![WaitFor::message_on_stderr("API:")]
}
fn tag(&self) -> String {
MINIO_IMAGE_TAG.into()
}
fn env_vars(&self) -> Box<dyn Iterator<Item = (&String, &String)> + '_> {
self.inner.env_vars()
delegate! {
to self.inner {
fn name(&self) -> &str;
fn expose_ports(&self) -> &[ContainerPort];
fn env_vars(
&self,
) -> impl IntoIterator<Item = (impl Into<Cow<'_, str>>, impl Into<Cow<'_, str>>)>;
fn mounts(&self) -> impl IntoIterator<Item = &testcontainers::core::Mount>;
fn copy_to_sources(&self) -> impl IntoIterator<Item = &testcontainers::CopyToContainer>;
fn entrypoint(&self) -> Option<&str>;
fn cmd(&self) -> impl IntoIterator<Item = impl Into<std::borrow::Cow<'_, str>>>;
fn exec_after_start(
&self,
cs: testcontainers::core::ContainerState,
) -> Result<Vec<testcontainers::core::ExecCommand>, testcontainers::TestcontainersError>;
}
}
}

View file

@ -13,9 +13,9 @@ use {
pub struct Test {
pub base_url: Url,
pub bucket: s3::Bucket,
pub bucket: Box<s3::Bucket>,
pub serves3: tokio::process::Child,
pub minio: ContainerAsync<minio::MinIO>,
pub _minio: ContainerAsync<minio::MinIO>,
}
const MAXIMUM_SERVES3_INIT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
@ -27,11 +27,10 @@ const SECRET_KEY: &'static str = "minioadmin";
impl Test {
pub async fn new() -> Result<Self> {
// NOTE: right now there is a bug in bollard
// that makes testcontainers work in Docker only and
// not podman (it is not able to fetch exposed ports).
// If this test fails make sure you are using docker.
std::env::remove_var("DOCKER_HOST");
// NOTE: this testsuite was setup to work
// against a recent version of podman,
// which correctly distinguishes between
// stdout and stderr of the running container.
let image = minio::MinIO::default();
let container = image.start().await?;
@ -107,7 +106,7 @@ impl Test {
base_url,
bucket,
serves3: child,
minio: container,
_minio: container,
})
}
}