From 4147722789e4136e0718a2f27581fcfeaacf23ee Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Sat, 28 May 2022 16:46:49 +0100 Subject: [PATCH 1/6] Bump models to match v20.10.16 release --- codegen/pom.xml | 8 ++-- codegen/target/generated-sources/Cargo.toml | 2 +- codegen/target/generated-sources/README.md | 6 +-- .../target/generated-sources/src/models.rs | 37 +++++++++---------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/codegen/pom.xml b/codegen/pom.xml index 8c74509b..db197c4d 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -19,10 +19,10 @@ generate - - https://raw.githubusercontent.com/moby/moby/master/docs/api/v1.41.yaml + https://docs.docker.com/engine/api/v1.41.yaml bollard.BollardCodegen ${project.build.directory}/generated-sources true @@ -30,7 +30,7 @@ models.rs,lib.rs,Cargo.toml,config,README.md bollard-stubs - 1.42.0-rc.0 + 1.42.0-rc.1 diff --git a/codegen/target/generated-sources/Cargo.toml b/codegen/target/generated-sources/Cargo.toml index c5a69383..430c9d31 100644 --- a/codegen/target/generated-sources/Cargo.toml +++ b/codegen/target/generated-sources/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bollard-stubs" -version = "1.42.0-rc.0" +version = "1.42.0-rc.1" authors = [ "Bollard contributors" ] description = "Stubs used for the Bollard rust async Docker client API" license = "Apache-2.0" diff --git a/codegen/target/generated-sources/README.md b/codegen/target/generated-sources/README.md index 821a5c6a..adb4347d 100644 --- a/codegen/target/generated-sources/README.md +++ b/codegen/target/generated-sources/README.md @@ -7,9 +7,9 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) -- API version: 1.42.0-rc.0 -- Code generation suffix: 1.42.0-rc.0 -- Build date: 2022-03-23T16:54:11.696Z +- API version: 1.42.0-rc.1 +- Code generation suffix: 1.42.0-rc.1 +- Build date: 2022-05-28T16:45:15.437+01:00 This autogenerated project defines an API crate `bollard-stubs` which contains: * Data types representing the underlying data model. diff --git a/codegen/target/generated-sources/src/models.rs b/codegen/target/generated-sources/src/models.rs index 72cbf10c..1a4a6344 100644 --- a/codegen/target/generated-sources/src/models.rs +++ b/codegen/target/generated-sources/src/models.rs @@ -801,6 +801,16 @@ pub struct ContainerUpdateResponse { } +/// container waiting error, if any +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +pub struct ContainerWaitExitError { + /// Details of an error + #[serde(rename = "Message")] + #[serde(skip_serializing_if="Option::is_none")] + pub message: Option, + +} + /// OK response to ContainerWait operation #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] pub struct ContainerWaitResponse { @@ -809,18 +819,7 @@ pub struct ContainerWaitResponse { pub status_code: i64, #[serde(rename = "Error")] - #[serde(skip_serializing_if="Option::is_none")] - pub error: Option, - -} - -/// container waiting error, if any -#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] -pub struct ContainerWaitResponseError { - /// Details of an error - #[serde(rename = "Message")] - #[serde(skip_serializing_if="Option::is_none")] - pub message: Option, + pub error: ContainerWaitExitError, } @@ -2028,7 +2027,7 @@ pub struct HostConfig { #[serde(skip_serializing_if="Option::is_none")] pub readonly_rootfs: Option, - /// A list of string values to customize labels for MLS systems, such as SELinux. + /// A list of string values to customize labels for MLS systems, such as SELinux. #[serde(rename = "SecurityOpt")] #[serde(skip_serializing_if="Option::is_none")] pub security_opt: Option>, @@ -3117,7 +3116,7 @@ pub struct NetworkPruneResponse { /// NetworkSettings exposes the network settings in the API #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] pub struct NetworkSettings { - /// Name of the network's bridge (for example, `docker0`). + /// Name of the network'a bridge (for example, `docker0`). #[serde(rename = "Bridge")] #[serde(skip_serializing_if="Option::is_none")] pub bridge: Option, @@ -5159,7 +5158,7 @@ pub struct SwarmJoinRequest { #[serde(skip_serializing_if="Option::is_none")] pub advertise_addr: Option, - /// Address or interface to use for data path traffic (format: ``), for example, `192.168.1.1`, or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr` is used. The `DataPathAddr` specifies the address that global scope network drivers will publish towards other nodes in order to reach the containers running on this node. Using this parameter it is possible to separate the container data traffic from the management traffic of the cluster. + /// Address or interface to use for data path traffic (format: ``), for example, `192.168.1.1`, or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same addres as `AdvertiseAddr` is used. The `DataPathAddr` specifies the address that global scope network drivers will publish towards other nodes in order to reach the containers running on this node. Using this parameter it is possible to separate the container data traffic from the management traffic of the cluster. #[serde(rename = "DataPathAddr")] #[serde(skip_serializing_if="Option::is_none")] pub data_path_addr: Option, @@ -5672,7 +5671,7 @@ pub struct SystemInfo { #[serde(skip_serializing_if="Option::is_none")] pub experimental_build: Option, - /// Version string of the daemon. > **Note**: the [standalone Swarm API](https://docs.docker.com/swarm/swarm-api/) > returns the Swarm version instead of the daemon version, for example > `swarm/1.2.8`. + /// Version string of the daemon. > **Note**: the [standalone Swarm API](/swarm/swarm-api/) > returns the Swarm version instead of the daemon version, for example > `swarm/1.2.8`. #[serde(rename = "ServerVersion")] #[serde(skip_serializing_if="Option::is_none")] pub server_version: Option, @@ -6565,9 +6564,9 @@ pub struct TaskSpecResources { pub limits: Option, /// Define resources reservation. - #[serde(rename = "Reservation")] + #[serde(rename = "Reservations")] #[serde(skip_serializing_if="Option::is_none")] - pub reservation: Option, + pub reservations: Option, } @@ -6905,7 +6904,7 @@ impl ::std::convert::AsRef for VolumeScopeEnum { /// Volume configuration #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] -pub struct VolumeConfig { +pub struct VolumeCreateOptions { /// The new volume's name. If not specified, Docker generates a name. #[serde(rename = "Name")] #[serde(skip_serializing_if="Option::is_none")] From f0b13b90347890a5f22349a1f0baf1a30dda0f56 Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Sat, 28 May 2022 16:59:09 +0100 Subject: [PATCH 2/6] Bump swagger version to 2.4.27 --- codegen/pom.xml | 4 ++-- codegen/target/generated-sources/.swagger-codegen/VERSION | 2 +- codegen/target/generated-sources/README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/codegen/pom.xml b/codegen/pom.xml index db197c4d..e9133bfa 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -12,7 +12,7 @@ io.swagger swagger-codegen-maven-plugin - 2.4.26 + 2.4.27 @@ -55,7 +55,7 @@ io.swagger swagger-codegen - 2.4.26 + 2.4.27 diff --git a/codegen/target/generated-sources/.swagger-codegen/VERSION b/codegen/target/generated-sources/.swagger-codegen/VERSION index 21f40d97..d32233fe 100644 --- a/codegen/target/generated-sources/.swagger-codegen/VERSION +++ b/codegen/target/generated-sources/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.26 \ No newline at end of file +2.4.27 \ No newline at end of file diff --git a/codegen/target/generated-sources/README.md b/codegen/target/generated-sources/README.md index adb4347d..8af02efc 100644 --- a/codegen/target/generated-sources/README.md +++ b/codegen/target/generated-sources/README.md @@ -9,7 +9,7 @@ To see how to make this your own, look here: - API version: 1.42.0-rc.1 - Code generation suffix: 1.42.0-rc.1 -- Build date: 2022-05-28T16:45:15.437+01:00 +- Build date: 2022-05-28T16:58:45.507+01:00 This autogenerated project defines an API crate `bollard-stubs` which contains: * Data types representing the underlying data model. From 60ee86b6e491ea0247b4049f8298d178b6fadfa7 Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Sat, 28 May 2022 17:47:06 +0100 Subject: [PATCH 3/6] Peg on bollard-stubs release 1.42.0-rc.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f3ab1bf5..59559583 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ ct_logs = ["ssl", "ct-logs"] [dependencies] base64 = "0.13" -bollard-stubs = { version = "=1.42.0-rc.0" } +bollard-stubs = { version = "=1.42.0-rc.1" } bytes = "1" chrono = { version = "0.4", features = ["serde"] } ct-logs = { version = "0.9.0", optional = true } From 919e3e5a6bd2ad1fb076b4c39aa446ec3d3ad3d3 Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Sat, 28 May 2022 17:56:57 +0100 Subject: [PATCH 4/6] Fix tests due to new ContainerWaitResponse type --- tests/image_test.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/image_test.rs b/tests/image_test.rs index 2ce6f672..c7811fee 100644 --- a/tests/image_test.rs +++ b/tests/image_test.rs @@ -241,9 +241,7 @@ async fn commit_container_test(docker: Docker) -> Result<(), Error> { .await?; let first = vec.get(0).unwrap(); - if let Some(error) = &first.error { - println!("{}", error.message.as_ref().unwrap()); - } + println!("{}", first.error.message.as_ref().unwrap()); assert_eq!(first.status_code, 0); let _ = &docker @@ -358,9 +356,7 @@ RUN touch bollard.txt .await?; let first = vec.get(0).unwrap(); - if let Some(error) = &first.error { - println!("{}", error.message.as_ref().unwrap()); - } + println!("{}", first.error.message.as_ref().unwrap()); assert_eq!(first.status_code, 0); let _ = &docker .remove_container("integration_test_build_image", None) From dee8a8a602c76cc8cc5373eafa3159becfbf7d34 Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Sat, 28 May 2022 18:08:23 +0100 Subject: [PATCH 5/6] Bump circleci image to v20.10.16 Signed-off-by: Niel Drummond --- .circleci/config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 989e9823..832dca83 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 jobs: test_ssl: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker @@ -15,7 +15,7 @@ jobs: - run: docker run -ti -e DOCKER_CERT_PATH=/certs -e DOCKER_HOST='tcp://test.example.com:2376' --volumes-from certs --rm --link test-docker-daemon:docker bollard cargo test --features test_ssl,ct_logs -- --test test_version_ssl test_http: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker @@ -24,7 +24,7 @@ jobs: - run: docker run -ti -e DOCKER_HOST='tcp://test.example.com:2375' --rm --link test-docker-daemon:docker bollard cargo test --features test_http -- --test test_version_http test_unix: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker @@ -32,7 +32,7 @@ jobs: - run: dockerfiles/bin/run_integration_tests.sh test_doc: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker @@ -40,7 +40,7 @@ jobs: - run: docker run -ti --rm bollard cargo test --target x86_64-unknown-linux-gnu --doc test_clippy: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker @@ -48,7 +48,7 @@ jobs: - run: docker run -ti --rm bollard bash -c "rustup component add clippy && cargo clippy --all-targets -- -Dwarnings -Aclippy::upper_case_acronyms" test_audit: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker @@ -57,7 +57,7 @@ jobs: - run: docker run -ti --rm bollard bash -c "cargo install cargo-audit && cargo audit --deny warnings --ignore=RUSTSEC-2020-0159 --ignore=RUSTSEC-2020-0071" test_fmt: docker: - - image: docker:20.10.11 + - image: docker:20.10.16 steps: - checkout - setup_remote_docker From 32ba4536f55b97db31c7b5830494238b2c34ca20 Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Tue, 31 May 2022 18:02:18 +0100 Subject: [PATCH 6/6] Peg models to a06bae9 in moby --- Cargo.toml | 2 +- codegen/pom.xml | 7 ++-- codegen/target/generated-sources/Cargo.toml | 2 +- codegen/target/generated-sources/README.md | 6 ++-- .../target/generated-sources/src/models.rs | 35 ++++++++++++------- tests/image_test.rs | 8 +++-- tests/volume_test.rs | 20 +++++++---- 7 files changed, 52 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 59559583..dd1ef330 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ ct_logs = ["ssl", "ct-logs"] [dependencies] base64 = "0.13" -bollard-stubs = { version = "=1.42.0-rc.1" } +bollard-stubs = { version = "=1.42.0-rc.2" } bytes = "1" chrono = { version = "0.4", features = ["serde"] } ct-logs = { version = "0.9.0", optional = true } diff --git a/codegen/pom.xml b/codegen/pom.xml index e9133bfa..6c73d3e2 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -19,10 +19,11 @@ generate - https://docs.docker.com/engine/api/v1.41.yaml + --> + https://raw.githubusercontent.com/moby/moby/a06bae909494b43daadc0ee60dbce79231616470/docs/api/v1.41.yaml bollard.BollardCodegen ${project.build.directory}/generated-sources true @@ -30,7 +31,7 @@ models.rs,lib.rs,Cargo.toml,config,README.md bollard-stubs - 1.42.0-rc.1 + 1.42.0-rc.2 diff --git a/codegen/target/generated-sources/Cargo.toml b/codegen/target/generated-sources/Cargo.toml index 430c9d31..099feabd 100644 --- a/codegen/target/generated-sources/Cargo.toml +++ b/codegen/target/generated-sources/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bollard-stubs" -version = "1.42.0-rc.1" +version = "1.42.0-rc.2" authors = [ "Bollard contributors" ] description = "Stubs used for the Bollard rust async Docker client API" license = "Apache-2.0" diff --git a/codegen/target/generated-sources/README.md b/codegen/target/generated-sources/README.md index 8af02efc..418bbcb1 100644 --- a/codegen/target/generated-sources/README.md +++ b/codegen/target/generated-sources/README.md @@ -7,9 +7,9 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) -- API version: 1.42.0-rc.1 -- Code generation suffix: 1.42.0-rc.1 -- Build date: 2022-05-28T16:58:45.507+01:00 +- API version: 1.42.0-rc.2 +- Code generation suffix: 1.42.0-rc.2 +- Build date: 2022-05-31T18:04:02.348+01:00 This autogenerated project defines an API crate `bollard-stubs` which contains: * Data types representing the underlying data model. diff --git a/codegen/target/generated-sources/src/models.rs b/codegen/target/generated-sources/src/models.rs index 1a4a6344..ecf128b6 100644 --- a/codegen/target/generated-sources/src/models.rs +++ b/codegen/target/generated-sources/src/models.rs @@ -284,7 +284,7 @@ pub struct ContainerChangeResponseItem { } -/// Configuration for a container that is portable between hosts. +/// Configuration for a container that is portable between hosts. When used as `ContainerConfig` field in an image, `ContainerConfig` is an optional field containing the configuration of the container that was last committed when creating the image. Previous versions of Docker builder used this field to store build cache, and it is not in active use anymore. #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] pub struct ContainerConfig { /// The hostname to use for the container, as a valid RFC 1123 hostname. @@ -819,7 +819,8 @@ pub struct ContainerWaitResponse { pub status_code: i64, #[serde(rename = "Error")] - pub error: ContainerWaitExitError, + #[serde(skip_serializing_if="Option::is_none")] + pub error: Option, } @@ -2055,7 +2056,7 @@ pub struct HostConfig { /// Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. #[serde(rename = "ShmSize")] #[serde(skip_serializing_if="Option::is_none")] - pub shm_size: Option, + pub shm_size: Option, /// A list of kernel parameters (sysctls) to set in the container. For example: ``` {\"net.ipv4.ip_forward\": \"1\"} ``` #[serde(rename = "Sysctls")] @@ -2230,12 +2231,12 @@ pub struct ImageId { /// Information about an image in the local image cache. #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] pub struct ImageInspect { - /// ID is the content-addressable ID of an image. This identified is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image. + /// ID is the content-addressable ID of an image. This identifier is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image. #[serde(rename = "Id")] #[serde(skip_serializing_if="Option::is_none")] pub id: Option, - /// List of image names/tags in the local image cache that reference this image. Multiple image tags can refer to the same imagem and this list may be empty if no tags reference the image, in which case the image is \"untagged\", in which case it can still be referenced by its ID. + /// List of image names/tags in the local image cache that reference this image. Multiple image tags can refer to the same image, and this list may be empty if no tags reference the image, in which case the image is \"untagged\", in which case it can still be referenced by its ID. #[serde(rename = "RepoTags")] #[serde(skip_serializing_if="Option::is_none")] pub repo_tags: Option>, @@ -2389,36 +2390,46 @@ pub struct ImageSearchResponseItem { #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] pub struct ImageSummary { + /// ID is the content-addressable ID of an image. This identifier is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image. #[serde(rename = "Id")] pub id: String, + /// ID of the parent image. Depending on how the image was created, this field may be empty and is only set for images that were built/created locally. This field is empty if the image was pulled from an image registry. #[serde(rename = "ParentId")] pub parent_id: String, + /// List of image names/tags in the local image cache that reference this image. Multiple image tags can refer to the same image, and this list may be empty if no tags reference the image, in which case the image is \"untagged\", in which case it can still be referenced by its ID. #[serde(rename = "RepoTags")] #[serde(deserialize_with = "deserialize_nonoptional_vec")] pub repo_tags: Vec, + /// List of content-addressable digests of locally available image manifests that the image is referenced from. Multiple manifests can refer to the same image. These digests are usually only available if the image was either pulled from a registry, or if the image was pushed to a registry, which is when the manifest is generated and its digest calculated. #[serde(rename = "RepoDigests")] #[serde(deserialize_with = "deserialize_nonoptional_vec")] pub repo_digests: Vec, + /// Date and time at which the image was created as a Unix timestamp (number of seconds sinds EPOCH). #[serde(rename = "Created")] pub created: i64, + /// Total size of the image including all layers it is composed of. #[serde(rename = "Size")] pub size: i64, + /// Total size of image layers that are shared between this image and other images. This size is not calculated by default. `-1` indicates that the value has not been set / calculated. #[serde(rename = "SharedSize")] pub shared_size: i64, + /// Total size of the image including all layers it is composed of. In versions of Docker before v1.10, this field was calculated from the image itself and all of its parent images. Docker v1.10 and up store images self-contained, and no longer use a parent-chain, making this field an equivalent of the Size field. This field is kept for backward compatibility, but may be removed in a future version of the API. #[serde(rename = "VirtualSize")] pub virtual_size: i64, + /// User-defined key/value metadata. #[serde(rename = "Labels")] #[serde(deserialize_with = "deserialize_nonoptional_map")] pub labels: HashMap, + /// Number of containers using this image. Includes both stopped and running containers. This size is not calculated by default, and depends on which API endpoint is used. `-1` indicates that the value has not been set / calculated. #[serde(rename = "Containers")] pub containers: i64, @@ -3116,7 +3127,7 @@ pub struct NetworkPruneResponse { /// NetworkSettings exposes the network settings in the API #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] pub struct NetworkSettings { - /// Name of the network'a bridge (for example, `docker0`). + /// Name of the network's bridge (for example, `docker0`). #[serde(rename = "Bridge")] #[serde(skip_serializing_if="Option::is_none")] pub bridge: Option, @@ -5158,7 +5169,7 @@ pub struct SwarmJoinRequest { #[serde(skip_serializing_if="Option::is_none")] pub advertise_addr: Option, - /// Address or interface to use for data path traffic (format: ``), for example, `192.168.1.1`, or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same addres as `AdvertiseAddr` is used. The `DataPathAddr` specifies the address that global scope network drivers will publish towards other nodes in order to reach the containers running on this node. Using this parameter it is possible to separate the container data traffic from the management traffic of the cluster. + /// Address or interface to use for data path traffic (format: ``), for example, `192.168.1.1`, or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr` is used. The `DataPathAddr` specifies the address that global scope network drivers will publish towards other nodes in order to reach the containers running on this node. Using this parameter it is possible to separate the container data traffic from the management traffic of the cluster. #[serde(rename = "DataPathAddr")] #[serde(skip_serializing_if="Option::is_none")] pub data_path_addr: Option, @@ -5671,7 +5682,7 @@ pub struct SystemInfo { #[serde(skip_serializing_if="Option::is_none")] pub experimental_build: Option, - /// Version string of the daemon. > **Note**: the [standalone Swarm API](/swarm/swarm-api/) > returns the Swarm version instead of the daemon version, for example > `swarm/1.2.8`. + /// Version string of the daemon. > **Note**: the [standalone Swarm API](https://docs.docker.com/swarm/swarm-api/) > returns the Swarm version instead of the daemon version, for example > `swarm/1.2.8`. #[serde(rename = "ServerVersion")] #[serde(skip_serializing_if="Option::is_none")] pub server_version: Option, @@ -6932,13 +6943,13 @@ pub struct VolumeCreateOptions { pub struct VolumeListResponse { /// List of volumes #[serde(rename = "Volumes")] - #[serde(deserialize_with = "deserialize_nonoptional_vec")] - pub volumes: Vec, + #[serde(skip_serializing_if="Option::is_none")] + pub volumes: Option>, /// Warnings that occurred when fetching the list of volumes. #[serde(rename = "Warnings")] - #[serde(deserialize_with = "deserialize_nonoptional_vec")] - pub warnings: Vec, + #[serde(skip_serializing_if="Option::is_none")] + pub warnings: Option>, } diff --git a/tests/image_test.rs b/tests/image_test.rs index c7811fee..2ce6f672 100644 --- a/tests/image_test.rs +++ b/tests/image_test.rs @@ -241,7 +241,9 @@ async fn commit_container_test(docker: Docker) -> Result<(), Error> { .await?; let first = vec.get(0).unwrap(); - println!("{}", first.error.message.as_ref().unwrap()); + if let Some(error) = &first.error { + println!("{}", error.message.as_ref().unwrap()); + } assert_eq!(first.status_code, 0); let _ = &docker @@ -356,7 +358,9 @@ RUN touch bollard.txt .await?; let first = vec.get(0).unwrap(); - println!("{}", first.error.message.as_ref().unwrap()); + if let Some(error) = &first.error { + println!("{}", error.message.as_ref().unwrap()); + } assert_eq!(first.status_code, 0); let _ = &docker .remove_container("integration_test_build_image", None) diff --git a/tests/volume_test.rs b/tests/volume_test.rs index 68795089..ef898261 100644 --- a/tests/volume_test.rs +++ b/tests/volume_test.rs @@ -35,8 +35,11 @@ async fn list_volumes_test(docker: Docker) -> Result<(), Error> { })) .await?; - assert_eq!(results.volumes.len(), 1); - assert_eq!(results.volumes[0].name, "integration_test_list_volumes"); + assert_eq!(results.volumes.as_ref().unwrap().len(), 1); + assert_eq!( + results.volumes.as_ref().unwrap()[0].name, + "integration_test_list_volumes" + ); let remove_volume_options = RemoveVolumeOptions { force: true }; let _ = &docker @@ -124,7 +127,7 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> { })) .await?; - assert_eq!(results.volumes.len(), 0); + assert_eq!(results.volumes, None); let mut list_volumes_filters = HashMap::new(); list_volumes_filters.insert("label", vec!["maintainer=bollard-maintainer"]); @@ -135,8 +138,11 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> { })) .await?; - assert_eq!(results.volumes.len(), 1); - assert_eq!(results.volumes[0].name, "integration_test_prune_volumes_2"); + assert_eq!(results.volumes.as_ref().unwrap().len(), 1); + assert_eq!( + results.volumes.as_ref().unwrap()[0].name, + "integration_test_prune_volumes_2" + ); let results = &docker.list_volumes::(None).await?; @@ -146,13 +152,15 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> { String::from("bollard-maintainer"), ); - assert_ne!(0, results.volumes.len()); + assert_ne!(0, results.volumes.as_ref().unwrap().len()); // we need to filter the results, because volumes without a label are not pruned assert_eq!( &expected_results_label, &results .volumes + .as_ref() + .unwrap() .iter() .find(|v| !v.labels.is_empty()) .unwrap()