mirror of
https://github.com/anthonyoteri/dredge.git
synced 2026-06-05 15:26:53 -04:00
Compare commits
21 Commits
v0.2.0
...
9b602f70a6
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b602f70a6 | |||
| f12615a7f2 | |||
| 39c03a2b5b | |||
| f836b26930 | |||
| 0d9761178c | |||
| 358a19f6f7 | |||
| 0527b6268d | |||
| 67c02581f3 | |||
| b6fda7162f | |||
| 07746429bb | |||
| 23f1d21a2e | |||
| 5e7d0e4e1e | |||
| 600c2d86ac | |||
| 0e4219b405 | |||
| c7305f8cc4 | |||
| 02dd2ec90a | |||
| b60d433508 | |||
| 0712af9d23 | |||
| 42f8f46bd3 | |||
| 80d1acf295 | |||
| 12dd298706 |
@@ -45,7 +45,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload analysis results ot GitHub
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: rust-clippy-results.sarif
|
||||
wait-for-processing: true
|
||||
@@ -0,0 +1,6 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright 2023 Anthony Oteri Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, modified, or distributed except according to those terms." />
|
||||
<option name="myName" value="MIT OR Apache-2.0 (personal)" />
|
||||
</copyright>
|
||||
</component>
|
||||
Generated
+1
-1
@@ -1,7 +1,7 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings>
|
||||
<module2copyright>
|
||||
<element module="Project Files" copyright="Apache License (personal)" />
|
||||
<element module="Project Files" copyright="MIT OR Apache-2.0 (personal)" />
|
||||
</module2copyright>
|
||||
</settings>
|
||||
</component>
|
||||
+13
-8
@@ -1,13 +1,13 @@
|
||||
[package]
|
||||
name = "dredge"
|
||||
version = "0.2.0"
|
||||
name = "dredge-tool"
|
||||
version = "1.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Anthony Oteri"]
|
||||
description = "A Command Line tool for interracting with the Docker Registry API"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/anthonyoteri/dredge"
|
||||
rust-version = "1.72"
|
||||
license-file = "LICENSE"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = [
|
||||
"docker",
|
||||
"registry",
|
||||
@@ -18,16 +18,20 @@ categories = [
|
||||
"api-bindings",
|
||||
]
|
||||
|
||||
|
||||
[[bin]]
|
||||
path = "src/main.rs"
|
||||
name = "dredge"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
async-std = { version = "1.12.0", features = ["async-attributes", "attributes", "tokio1"] }
|
||||
clap = { version = "4.4.3", features = ["derive", "env", "wrap_help"] }
|
||||
simple_logger = { version = "4.2.0", features = ["timestamps", "colors", "stderr"] }
|
||||
http = "0.2.9"
|
||||
simple_logger = { version = "5.0.0", features = ["timestamps", "colors", "stderr"] }
|
||||
http = "1.0.0"
|
||||
indoc = "2.0.4"
|
||||
log = "0.4.20"
|
||||
reqwest = { version = "0.11.20", features = ["json", "gzip", "multipart", "native-tls-vendored"] }
|
||||
reqwest = { version = "0.12.3", features = ["json", "gzip", "multipart", "native-tls-vendored"] }
|
||||
serde = { version = "1.0.188", features = ["derive"] }
|
||||
serde_toml = "0.0.1"
|
||||
serde_yaml = "0.9.25"
|
||||
@@ -35,7 +39,8 @@ thiserror = "1.0.48"
|
||||
toml = "0.8.0"
|
||||
url = { version = "2.4.1", features = ["serde"] }
|
||||
xdg = "2.5.2"
|
||||
tokio = { version = "1.32.0", features = ["macros"] }
|
||||
|
||||
[dev-dependencies]
|
||||
mockito = "1.2.0"
|
||||
env_logger = "0.10.0"
|
||||
env_logger = "0.11.3"
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -107,3 +107,19 @@ Arguments:
|
||||
Options:
|
||||
-h, --help Print help
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
|
||||
additional terms or conditions.
|
||||
|
||||
|
||||
+16
-2
@@ -1,13 +1,27 @@
|
||||
# Dredge Release Notes
|
||||
|
||||
## Legal
|
||||
|
||||
As of version 1.1.0, this software license has been changed from Apache-2.0
|
||||
to a dual-licensed Apache-2.0 OR MIT license.
|
||||
|
||||
## Known Issues
|
||||
|
||||
* The delete command is currently not implemented and will return an error
|
||||
if called.
|
||||
* Docker authentication is not currently supported, and attempts to query a
|
||||
registry which requires authentication will fail.
|
||||
|
||||
## Changelog
|
||||
- v1.1.0
|
||||
|
||||
- Change License by Anthony Oteri 0e4219b
|
||||
|
||||
- v1.0.0
|
||||
|
||||
- Rename project to dredge-tool by Anthony Oteri b60d433
|
||||
- Replace async_std::test with tokio::test by Anthony Oteri 42f8f46
|
||||
- Replace async-std with tokio by Anthony Oteri 80d1acf
|
||||
- Update known issues in release notes by Anthony Oteri 12dd298
|
||||
|
||||
- v0.2.0
|
||||
|
||||
- Support deleting an image tag by Anthony Oteri fbe43f0
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
- v1.0.0
|
||||
|
||||
- Rename project to dredge-tool by Anthony Oteri b60d433
|
||||
- Replace async_std::test with tokio::test by Anthony Oteri 42f8f46
|
||||
- Replace async-std with tokio by Anthony Oteri 80d1acf
|
||||
- Update known issues in release notes by Anthony Oteri 12dd298
|
||||
@@ -0,0 +1,3 @@
|
||||
- v1.1.0
|
||||
|
||||
- Change License by Anthony Oteri 0e4219b
|
||||
@@ -1,9 +1,12 @@
|
||||
# Dredge Release Notes
|
||||
|
||||
## Legal
|
||||
|
||||
As of version 1.1.0, this software license has been changed from Apache-2.0
|
||||
to a dual-licensed Apache-2.0 OR MIT license.
|
||||
|
||||
## Known Issues
|
||||
|
||||
* The delete command is currently not implemented and will return an error
|
||||
if called.
|
||||
* Docker authentication is not currently supported, and attempts to query a
|
||||
registry which requires authentication will fail.
|
||||
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
#
|
||||
# Copyright 2023 Anthony Oteri
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#!/usr/bin/bash
|
||||
|
||||
#
|
||||
# Copyright 2023 Anthony Oteri
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
# http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
# copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
|
||||
+8
-13
@@ -1,20 +1,15 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
#
|
||||
# Copyright 2023 Anthony Oteri
|
||||
# Copyright 2023 Anthony Oteri
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
# http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
# copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
|
||||
#!/usr/bin/bash -e
|
||||
set -e
|
||||
|
||||
version=$1
|
||||
previous=$2
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
#
|
||||
# Copyright 2023 Anthony Oteri
|
||||
# Copyright 2023 Anthony Oteri
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
# http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
# copied, modified, or distributed except according to those terms.
|
||||
#
|
||||
|
||||
#!/usr/bin/bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
|
||||
|
||||
+17
-24
@@ -1,20 +1,15 @@
|
||||
/*
|
||||
* Copyright 2023 Anthony Oteri
|
||||
* Copyright 2023 Anthony Oteri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
* http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
* copied, modified, or distributed except according to those terms.
|
||||
*/
|
||||
|
||||
use http::header;
|
||||
use reqwest::header;
|
||||
use reqwest::header::HeaderValue;
|
||||
use reqwest::StatusCode;
|
||||
use serde::Deserialize;
|
||||
use url::Url;
|
||||
|
||||
@@ -59,7 +54,7 @@ pub async fn fetch_paginated<T: for<'de> Deserialize<'de>>(
|
||||
responses.push(json);
|
||||
}
|
||||
|
||||
if let Some(p) = parse_rfc5988(headers.get(http::header::LINK))? {
|
||||
if let Some(p) = parse_rfc5988(headers.get(header::LINK))? {
|
||||
next_path = p;
|
||||
} else {
|
||||
break;
|
||||
@@ -80,7 +75,7 @@ pub async fn fetch_paginated<T: for<'de> Deserialize<'de>>(
|
||||
///
|
||||
/// Returns and `ApiError` if there is a problem parsing contents of the
|
||||
/// supplied header value.
|
||||
fn parse_rfc5988(header_value: Option<&http::HeaderValue>) -> Result<Option<String>, ApiError> {
|
||||
fn parse_rfc5988(header_value: Option<&HeaderValue>) -> Result<Option<String>, ApiError> {
|
||||
log::trace!("parse_rfc5988(header_value: {header_value:?})");
|
||||
|
||||
if let Some(link_value) = header_value {
|
||||
@@ -134,7 +129,7 @@ pub fn parse_response_status(response: &reqwest::Response) -> Result<(), ApiErro
|
||||
log::trace!("parse_response_status(response: {response:?})");
|
||||
|
||||
match response.status() {
|
||||
http::StatusCode::OK | http::StatusCode::ACCEPTED => {
|
||||
StatusCode::OK | StatusCode::ACCEPTED => {
|
||||
let headers = response.headers();
|
||||
if let Some(header_value) = headers.get("Docker-Distribution-API-Version") {
|
||||
if header_value.to_str()? == "registry/2.0" {
|
||||
@@ -148,8 +143,8 @@ pub fn parse_response_status(response: &reqwest::Response) -> Result<(), ApiErro
|
||||
))
|
||||
}
|
||||
}
|
||||
http::StatusCode::METHOD_NOT_ALLOWED => Err(ApiError::MethodNotAllowed),
|
||||
http::StatusCode::UNAUTHORIZED => {
|
||||
StatusCode::METHOD_NOT_ALLOWED => Err(ApiError::MethodNotAllowed),
|
||||
StatusCode::UNAUTHORIZED => {
|
||||
let headers = response.headers();
|
||||
if let Some(header_value) = headers.get("Docker-Distribution-API-Version") {
|
||||
if header_value.to_str()? == "registry/2.0" {
|
||||
@@ -163,7 +158,7 @@ pub fn parse_response_status(response: &reqwest::Response) -> Result<(), ApiErro
|
||||
))
|
||||
}
|
||||
}
|
||||
http::StatusCode::NOT_FOUND => Err(ApiError::NotFound),
|
||||
StatusCode::NOT_FOUND => Err(ApiError::NotFound),
|
||||
e => Err(ApiError::UnexpectedResponse(format!(
|
||||
"Undocumented status code: {e:?}"
|
||||
))),
|
||||
@@ -199,15 +194,13 @@ pub async fn get_digest(client: &reqwest::Client, url: &Url) -> Result<String, A
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use http::header::HeaderValue;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Test parsing a valid RFC5988 header value.
|
||||
///
|
||||
/// Attempt to parse a valid RFC5988 header value, and ensure that the
|
||||
/// parsed URL was returned as expected.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_parse_rfc5988_valid() {
|
||||
// Mock a valid RFC5988 header value
|
||||
let valid_header_value =
|
||||
@@ -225,7 +218,7 @@ mod tests {
|
||||
///
|
||||
/// Attempt to parse an invalid string as RFC5988, ensuring that the `None`
|
||||
/// variant is returned.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_parse_rfc5988_invalid() {
|
||||
// Mock a valid RFC5988 header value
|
||||
let invalid_header_value = HeaderValue::from_str(r#"invalid header value"#)
|
||||
@@ -244,7 +237,7 @@ mod tests {
|
||||
/// the digest with the proper headers set. The test then validates that
|
||||
/// the correct digest is returned and that the mock server had the expected
|
||||
/// interactions.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_get_digest() -> Result<(), ApiError> {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2/foo/manifests/latest";
|
||||
|
||||
+5
-12
@@ -1,17 +1,10 @@
|
||||
/*
|
||||
* Copyright 2023 Anthony Oteri
|
||||
* Copyright 2023 Anthony Oteri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
* http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
* copied, modified, or distributed except according to those terms.
|
||||
*/
|
||||
|
||||
#![allow(unused_imports)]
|
||||
|
||||
+13
-20
@@ -1,17 +1,10 @@
|
||||
/*
|
||||
* Copyright 2023 Anthony Oteri
|
||||
* Copyright 2023 Anthony Oteri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
* http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
* copied, modified, or distributed except according to those terms.
|
||||
*/
|
||||
|
||||
use std::io::Write;
|
||||
@@ -224,7 +217,7 @@ mod tests {
|
||||
/// This test spins up a mock server, and makes a request to the catalog
|
||||
/// endpoint. It checks that the handler both called the request the
|
||||
/// expected number of times, and did not return an error.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_catalog_handler() {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2/_catalog";
|
||||
@@ -253,7 +246,7 @@ mod tests {
|
||||
/// should follow, resulting in the combined list. It checks that the
|
||||
/// handler both called the request the expected number of times, and did
|
||||
/// not return an error.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_catalog_handler_with_pagination() {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2/_catalog";
|
||||
@@ -294,7 +287,7 @@ mod tests {
|
||||
/// This test spins up a mock server, and makes a request to the tags
|
||||
/// endpoint. It checks that the handler both called the request the
|
||||
/// expected number of times, and did not return an error.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_tags_handler() {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2/some_image/tags/list";
|
||||
@@ -324,7 +317,7 @@ mod tests {
|
||||
/// should follow, resulting in the combined list. It checks that the
|
||||
/// handler both called the request the expected number of times, and did
|
||||
/// not return an error.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_tags_handler_with_pagination() {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2/some_image/tags/list";
|
||||
@@ -366,7 +359,7 @@ mod tests {
|
||||
/// This test spins up a mock server, and makes a request to the check
|
||||
/// endpoint. It checks that the handler both called the request the
|
||||
/// expected number of times, and did not return an error.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_check_handler() {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2";
|
||||
@@ -392,7 +385,7 @@ mod tests {
|
||||
///
|
||||
/// This validates that if the "Docker-Distribution-API-Version" header
|
||||
/// is missing in the response, the appropriate error is returned.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_check_handler_missing_api_version() -> Result<(), Box<dyn Error>> {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2";
|
||||
@@ -425,7 +418,7 @@ mod tests {
|
||||
/// This validates that if the "Docker-Distribution-API-Version" header
|
||||
/// is present in the response but contains an unexpected value, the
|
||||
/// appropriate error is returned.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_check_handler_invalid_api_version() -> Result<(), Box<dyn Error>> {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2";
|
||||
@@ -459,7 +452,7 @@ mod tests {
|
||||
/// This test spins up a mock server, and makes a request to the image
|
||||
/// manifests endpoint. It checks that the handler both called the request
|
||||
/// the expected number of times, and did not return an error.
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_show_handler() {
|
||||
let mut server = mockito::Server::new_async().await;
|
||||
let path = "/v2/foo/manifests/latest";
|
||||
|
||||
+5
-12
@@ -1,17 +1,10 @@
|
||||
/*
|
||||
* Copyright 2023 Anthony Oteri
|
||||
* Copyright 2023 Anthony Oteri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
* http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
* copied, modified, or distributed except according to those terms.
|
||||
*/
|
||||
|
||||
#![allow(clippy::enum_variant_names)]
|
||||
|
||||
+6
-13
@@ -1,17 +1,10 @@
|
||||
/*
|
||||
* Copyright 2023 Anthony Oteri
|
||||
* Copyright 2023 Anthony Oteri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
* http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
* copied, modified, or distributed except according to those terms.
|
||||
*/
|
||||
|
||||
#![deny(clippy::pedantic)]
|
||||
@@ -57,7 +50,7 @@ fn parse_registry_arg(host: &str) -> Result<Url, DredgeError> {
|
||||
Url::parse(&host).or(Err(DredgeError::RegistryUrlError(host.to_string())))
|
||||
}
|
||||
|
||||
#[async_std::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<(), DredgeError> {
|
||||
let args = Cli::parse();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user