mirror of
https://github.com/anthonyoteri/dredge.git
synced 2026-06-05 15:26:53 -04:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c7305f8cc4 | |||
| 02dd2ec90a | |||
| b60d433508 | |||
| 0712af9d23 | |||
| 42f8f46bd3 | |||
| 80d1acf295 | |||
| 12dd298706 |
+9
-4
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dredge"
|
name = "dredge-tool"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Anthony Oteri"]
|
authors = ["Anthony Oteri"]
|
||||||
description = "A Command Line tool for interracting with the Docker Registry API"
|
description = "A Command Line tool for interracting with the Docker Registry API"
|
||||||
@@ -18,10 +18,14 @@ categories = [
|
|||||||
"api-bindings",
|
"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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-std = { version = "1.12.0", features = ["async-attributes", "attributes", "tokio1"] }
|
|
||||||
clap = { version = "4.4.3", features = ["derive", "env", "wrap_help"] }
|
clap = { version = "4.4.3", features = ["derive", "env", "wrap_help"] }
|
||||||
simple_logger = { version = "4.2.0", features = ["timestamps", "colors", "stderr"] }
|
simple_logger = { version = "4.2.0", features = ["timestamps", "colors", "stderr"] }
|
||||||
http = "0.2.9"
|
http = "0.2.9"
|
||||||
@@ -35,7 +39,8 @@ thiserror = "1.0.48"
|
|||||||
toml = "0.8.0"
|
toml = "0.8.0"
|
||||||
url = { version = "2.4.1", features = ["serde"] }
|
url = { version = "2.4.1", features = ["serde"] }
|
||||||
xdg = "2.5.2"
|
xdg = "2.5.2"
|
||||||
|
tokio = { version = "1.32.0", features = ["macros"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mockito = "1.2.0"
|
mockito = "1.2.0"
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
|
|||||||
+7
-2
@@ -2,12 +2,17 @@
|
|||||||
|
|
||||||
## Known Issues
|
## 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
|
* Docker authentication is not currently supported, and attempts to query a
|
||||||
registry which requires authentication will fail.
|
registry which requires authentication will fail.
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
- 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
|
- v0.2.0
|
||||||
|
|
||||||
- Support deleting an image tag by Anthony Oteri fbe43f0
|
- 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
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
## Known Issues
|
## 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
|
* Docker authentication is not currently supported, and attempts to query a
|
||||||
registry which requires authentication will fail.
|
registry which requires authentication will fail.
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -207,7 +207,7 @@ mod tests {
|
|||||||
///
|
///
|
||||||
/// Attempt to parse a valid RFC5988 header value, and ensure that the
|
/// Attempt to parse a valid RFC5988 header value, and ensure that the
|
||||||
/// parsed URL was returned as expected.
|
/// parsed URL was returned as expected.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_parse_rfc5988_valid() {
|
async fn test_parse_rfc5988_valid() {
|
||||||
// Mock a valid RFC5988 header value
|
// Mock a valid RFC5988 header value
|
||||||
let valid_header_value =
|
let valid_header_value =
|
||||||
@@ -225,7 +225,7 @@ mod tests {
|
|||||||
///
|
///
|
||||||
/// Attempt to parse an invalid string as RFC5988, ensuring that the `None`
|
/// Attempt to parse an invalid string as RFC5988, ensuring that the `None`
|
||||||
/// variant is returned.
|
/// variant is returned.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_parse_rfc5988_invalid() {
|
async fn test_parse_rfc5988_invalid() {
|
||||||
// Mock a valid RFC5988 header value
|
// Mock a valid RFC5988 header value
|
||||||
let invalid_header_value = HeaderValue::from_str(r#"invalid header value"#)
|
let invalid_header_value = HeaderValue::from_str(r#"invalid header value"#)
|
||||||
@@ -244,7 +244,7 @@ mod tests {
|
|||||||
/// the digest with the proper headers set. The test then validates that
|
/// 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
|
/// the correct digest is returned and that the mock server had the expected
|
||||||
/// interactions.
|
/// interactions.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_get_digest() -> Result<(), ApiError> {
|
async fn test_get_digest() -> Result<(), ApiError> {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/foo/manifests/latest";
|
let path = "/v2/foo/manifests/latest";
|
||||||
|
|||||||
+8
-8
@@ -224,7 +224,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the catalog
|
/// 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
|
/// endpoint. It checks that the handler both called the request the
|
||||||
/// expected number of times, and did not return an error.
|
/// expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_catalog_handler() {
|
async fn test_catalog_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/_catalog";
|
let path = "/v2/_catalog";
|
||||||
@@ -253,7 +253,7 @@ mod tests {
|
|||||||
/// should follow, resulting in the combined list. It checks that the
|
/// should follow, resulting in the combined list. It checks that the
|
||||||
/// handler both called the request the expected number of times, and did
|
/// handler both called the request the expected number of times, and did
|
||||||
/// not return an error.
|
/// not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_catalog_handler_with_pagination() {
|
async fn test_catalog_handler_with_pagination() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/_catalog";
|
let path = "/v2/_catalog";
|
||||||
@@ -294,7 +294,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the tags
|
/// 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
|
/// endpoint. It checks that the handler both called the request the
|
||||||
/// expected number of times, and did not return an error.
|
/// expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_tags_handler() {
|
async fn test_tags_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/some_image/tags/list";
|
let path = "/v2/some_image/tags/list";
|
||||||
@@ -324,7 +324,7 @@ mod tests {
|
|||||||
/// should follow, resulting in the combined list. It checks that the
|
/// should follow, resulting in the combined list. It checks that the
|
||||||
/// handler both called the request the expected number of times, and did
|
/// handler both called the request the expected number of times, and did
|
||||||
/// not return an error.
|
/// not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_tags_handler_with_pagination() {
|
async fn test_tags_handler_with_pagination() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/some_image/tags/list";
|
let path = "/v2/some_image/tags/list";
|
||||||
@@ -366,7 +366,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the check
|
/// 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
|
/// endpoint. It checks that the handler both called the request the
|
||||||
/// expected number of times, and did not return an error.
|
/// expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_check_handler() {
|
async fn test_check_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2";
|
let path = "/v2";
|
||||||
@@ -392,7 +392,7 @@ mod tests {
|
|||||||
///
|
///
|
||||||
/// This validates that if the "Docker-Distribution-API-Version" header
|
/// This validates that if the "Docker-Distribution-API-Version" header
|
||||||
/// is missing in the response, the appropriate error is returned.
|
/// 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>> {
|
async fn test_check_handler_missing_api_version() -> Result<(), Box<dyn Error>> {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2";
|
let path = "/v2";
|
||||||
@@ -425,7 +425,7 @@ mod tests {
|
|||||||
/// This validates that if the "Docker-Distribution-API-Version" header
|
/// This validates that if the "Docker-Distribution-API-Version" header
|
||||||
/// is present in the response but contains an unexpected value, the
|
/// is present in the response but contains an unexpected value, the
|
||||||
/// appropriate error is returned.
|
/// appropriate error is returned.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_check_handler_invalid_api_version() -> Result<(), Box<dyn Error>> {
|
async fn test_check_handler_invalid_api_version() -> Result<(), Box<dyn Error>> {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2";
|
let path = "/v2";
|
||||||
@@ -459,7 +459,7 @@ mod tests {
|
|||||||
/// This test spins up a mock server, and makes a request to the image
|
/// 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
|
/// manifests endpoint. It checks that the handler both called the request
|
||||||
/// the expected number of times, and did not return an error.
|
/// the expected number of times, and did not return an error.
|
||||||
#[async_std::test]
|
#[tokio::test]
|
||||||
async fn test_show_handler() {
|
async fn test_show_handler() {
|
||||||
let mut server = mockito::Server::new_async().await;
|
let mut server = mockito::Server::new_async().await;
|
||||||
let path = "/v2/foo/manifests/latest";
|
let path = "/v2/foo/manifests/latest";
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ fn parse_registry_arg(host: &str) -> Result<Url, DredgeError> {
|
|||||||
Url::parse(&host).or(Err(DredgeError::RegistryUrlError(host.to_string())))
|
Url::parse(&host).or(Err(DredgeError::RegistryUrlError(host.to_string())))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_std::main]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
async fn main() -> Result<(), DredgeError> {
|
async fn main() -> Result<(), DredgeError> {
|
||||||
let args = Cli::parse();
|
let args = Cli::parse();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user