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

@ -3,7 +3,7 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 rev: v4.6.0
hooks: hooks:
- id: check-yaml - id: check-yaml
name: Check YAML files syntax name: Check YAML files syntax
@ -40,7 +40,7 @@ repos:
name: Check Rust code name: Check Rust code
- repo: https://github.com/fsfe/reuse-tool.git - repo: https://github.com/fsfe/reuse-tool.git
rev: v3.0.2 rev: v4.0.3
hooks: hooks:
- id: reuse - id: reuse
name: Check copyright and license information name: Check copyright and license information

1602
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
[package] [package]
name = "serves3" name = "serves3"
version = "1.1.0" version = "1.1.1"
authors = ["Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>"] authors = ["Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>"]
description = "A very simple proxy to browse files from private S3 buckets" description = "A very simple proxy to browse files from private S3 buckets"
@ -26,20 +26,21 @@ lazy_static = "1.4"
log = "0.4" log = "0.4"
rocket = "0.5" rocket = "0.5"
rocket_dyn_templates = { version = "0.2.0", features = ["tera"] } rocket_dyn_templates = { version = "0.2.0", features = ["tera"] }
rust-s3 = { version = "0.33", default-features = false, features = [ rust-s3 = { version = "0.35", default-features = false, features = [
"tokio-native-tls", "tokio-rustls-tls",
] } ] }
serde = { version = "1.0" } serde = "1.0"
tempfile = { version = "3.6" } tempfile = "3.6"
[dev-dependencies] [dev-dependencies]
libc = "0.2" delegate = "0.13"
futures = "0.3" futures = "0.3"
libc = "0.2"
regex = "1.10" regex = "1.10"
rstest = "0.21"
reqwest = "0.12" reqwest = "0.12"
scraper = "0.19" rstest = "0.22"
scraper = "0.20"
test-log = "0.2" test-log = "0.2"
testcontainers = "0.17" testcontainers = "0.23"
testcontainers-modules = { version = "0.5", features = ["minio"] } testcontainers-modules = { version = "0.11", features = ["minio"] }
tokio = { version = "1", features = ["process"] } tokio = { version = "1", features = ["process"] }

View File

@ -64,10 +64,11 @@ allow = [
"Apache-2.0", "Apache-2.0",
"BSD-3-Clause", "BSD-3-Clause",
"CC0-1.0", "CC0-1.0",
"EUPL-1.2",
"ISC", "ISC",
"MIT", "MIT",
"OpenSSL",
"MPL-2.0", "MPL-2.0",
"Unicode-3.0",
"Unicode-DFS-2016", "Unicode-DFS-2016",
] ]
# The confidence threshold for detecting a license from license text. # The confidence threshold for detecting a license from license text.

View File

@ -7,10 +7,10 @@ use {anyhow::anyhow, rocket::serde::Deserialize, serde::de::Error};
#[serde(crate = "rocket::serde")] #[serde(crate = "rocket::serde")]
pub struct Settings { pub struct Settings {
#[serde(deserialize_with = "deserialize_s3_bucket")] #[serde(deserialize_with = "deserialize_s3_bucket")]
pub s3_bucket: s3::Bucket, pub s3_bucket: Box<s3::Bucket>,
} }
fn deserialize_s3_bucket<'de, D>(deserializer: D) -> Result<s3::Bucket, D::Error> fn deserialize_s3_bucket<'de, D>(deserializer: D) -> Result<Box<s3::Bucket>, D::Error>
where where
D: serde::Deserializer<'de>, D: serde::Deserializer<'de>,
{ {
@ -31,10 +31,10 @@ pub struct S3Config {
pub secret_access_key: String, pub secret_access_key: String,
} }
impl TryInto<s3::Bucket> for S3Config { impl TryInto<Box<s3::Bucket>> for S3Config {
type Error = anyhow::Error; type Error = anyhow::Error;
fn try_into(self) -> Result<s3::Bucket, Self::Error> { fn try_into(self) -> Result<Box<s3::Bucket>, Self::Error> {
let region = s3::Region::Custom { let region = s3::Region::Custom {
region: self.region, region: self.region,
endpoint: self.endpoint, endpoint: self.endpoint,

View File

@ -1,31 +1,47 @@
// SPDX-FileCopyrightText: © Matteo Settenvini <matteo.settenvini@montecristosoftware.eu> // SPDX-FileCopyrightText: © Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
// SPDX-License-Identifier: EUPL-1.2 // 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 { pub struct MinIO {
inner: minio::MinIO, inner: minio::MinIO,
} }
impl Image for MinIO { impl Image for MinIO {
type Args = minio::MinIOServerArgs; fn tag(&self) -> &str {
MINIO_IMAGE_TAG.into()
fn name(&self) -> String {
self.inner.name()
} }
fn ready_conditions(&self) -> Vec<WaitFor> { fn ready_conditions(&self) -> Vec<WaitFor> {
vec![WaitFor::message_on_stderr("API:")] vec![WaitFor::message_on_stderr("API:")]
} }
fn tag(&self) -> String { delegate! {
MINIO_IMAGE_TAG.into() 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>;
} }
fn env_vars(&self) -> Box<dyn Iterator<Item = (&String, &String)> + '_> {
self.inner.env_vars()
} }
} }

View File

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