From 8db4dffa7f3c7dcc5beacec1f252a8c988d83a9c Mon Sep 17 00:00:00 2001 From: ZichengMa Date: Mon, 16 Oct 2023 10:35:52 +0800 Subject: [PATCH] Add unit tests for all types of volume objects (#342) Signed-off-by: ZichengMa --- src/kubernetes_api_objects/volume.rs | 30 ++++++++ .../configmap_projection.rs | 73 +++++++++++++++++++ .../configmap_volume_source.rs | 28 +++++++ .../downwardapi_volume_file.rs | 33 +++++++++ .../downwardapi_volume_source.rs | 44 +++++++++++ .../empty_dir_volume_source.rs | 0 .../hostpath_volume_source.rs | 28 +++++++ .../kubernetes_api_objects/key_to_path.rs | 36 +++++++++ src/unit_tests/kubernetes_api_objects/mod.rs | 12 +++ .../projected_volume_source.rs | 44 +++++++++++ .../secret_projection.rs | 54 ++++++++++++++ .../secret_volume_source.rs | 29 ++++++++ .../kubernetes_api_objects/volume.rs | 43 +++++++++++ .../volume_projection.rs | 39 ++++++++++ 14 files changed, 493 insertions(+) create mode 100644 src/unit_tests/kubernetes_api_objects/configmap_projection.rs create mode 100644 src/unit_tests/kubernetes_api_objects/configmap_volume_source.rs create mode 100644 src/unit_tests/kubernetes_api_objects/downwardapi_volume_file.rs create mode 100644 src/unit_tests/kubernetes_api_objects/downwardapi_volume_source.rs create mode 100644 src/unit_tests/kubernetes_api_objects/empty_dir_volume_source.rs create mode 100644 src/unit_tests/kubernetes_api_objects/hostpath_volume_source.rs create mode 100644 src/unit_tests/kubernetes_api_objects/key_to_path.rs create mode 100644 src/unit_tests/kubernetes_api_objects/projected_volume_source.rs create mode 100644 src/unit_tests/kubernetes_api_objects/secret_projection.rs create mode 100644 src/unit_tests/kubernetes_api_objects/secret_volume_source.rs create mode 100644 src/unit_tests/kubernetes_api_objects/volume.rs create mode 100644 src/unit_tests/kubernetes_api_objects/volume_projection.rs diff --git a/src/kubernetes_api_objects/volume.rs b/src/kubernetes_api_objects/volume.rs index b6c5292d9..dafcd82fa 100644 --- a/src/kubernetes_api_objects/volume.rs +++ b/src/kubernetes_api_objects/volume.rs @@ -315,6 +315,16 @@ impl ConfigMapProjection { } } + #[verifier(external_body)] + pub fn clone(&self) -> (config_map_projection: ConfigMapProjection) + ensures + config_map_projection@ == self@, + { + ConfigMapProjection { + inner: self.inner.clone(), + } + } + #[verifier(external_body)] pub fn set_name(&mut self, name: String) ensures @@ -357,6 +367,16 @@ impl SecretProjection { } } + #[verifier(external_body)] + pub fn clone(&self) -> (secret_projection: SecretProjection) + ensures + secret_projection@ == self@, + { + SecretProjection { + inner: self.inner.clone(), + } + } + #[verifier(external_body)] pub fn set_name(&mut self, name: String) ensures @@ -513,6 +533,16 @@ impl ObjectFieldSelector { } } + #[verifier(external_body)] + pub fn clone(&self) -> (object_field_selector: ObjectFieldSelector) + ensures + object_field_selector@ == self@, + { + ObjectFieldSelector { + inner: self.inner.clone(), + } + } + pub fn new_with(api_version: String, field_path: String) -> (object_field_selector: ObjectFieldSelector) ensures object_field_selector@ == ObjectFieldSelectorView::default().set_api_version(api_version@).set_field_path(field_path@), diff --git a/src/unit_tests/kubernetes_api_objects/configmap_projection.rs b/src/unit_tests/kubernetes_api_objects/configmap_projection.rs new file mode 100644 index 000000000..bcf7b13cd --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/configmap_projection.rs @@ -0,0 +1,73 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for configmap projecion +#[test] +#[verifier(external)] +pub fn test_default() { + let config_map_projection = ConfigMapProjection::default(); + assert_eq!(config_map_projection.into_kube(), deps_hack::k8s_openapi::api::core::v1::ConfigMapProjection::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_name() { + let mut config_map_projection = ConfigMapProjection::default(); + config_map_projection.set_name(new_strlit("name").to_string()); + assert_eq!("name".to_string(), config_map_projection.into_kube().name.unwrap()); +} + +#[test] +#[verifier(external)] +pub fn test_set_items() { + let mut config_map_projection = ConfigMapProjection::default(); + let key_to_paths_gen = || { + let mut key_to_path_1 = KeyToPath::default(); + let mut key_to_path_2 = KeyToPath::default(); + let mut key_to_paths = Vec::new(); + key_to_path_1.set_key(new_strlit("key1").to_string()); + key_to_path_1.set_path(new_strlit("path1").to_string()); + key_to_path_2.set_key(new_strlit("key2").to_string()); + key_to_path_2.set_path(new_strlit("path2").to_string()); + key_to_paths.push(key_to_path_1); + key_to_paths.push(key_to_path_2); + key_to_paths + }; + config_map_projection.set_items(key_to_paths_gen()); + assert_eq!( + key_to_paths_gen() + .into_iter() + .map(|s: KeyToPath| s.into_kube()) + .collect::>(), + config_map_projection.into_kube().items.unwrap() + ); +} + +#[test] +#[verifier(external)] +pub fn test_clone() { + let mut config_map_projection = ConfigMapProjection::default(); + config_map_projection.set_name(new_strlit("name").to_string()); + let mut key_to_path_1 = KeyToPath::default(); + let mut key_to_path_2 = KeyToPath::default(); + let mut key_to_paths = Vec::new(); + key_to_path_1.set_key(new_strlit("key1").to_string()); + key_to_path_1.set_path(new_strlit("path1").to_string()); + key_to_path_2.set_key(new_strlit("key2").to_string()); + key_to_path_2.set_path(new_strlit("path2").to_string()); + key_to_paths.push(key_to_path_1); + key_to_paths.push(key_to_path_2); + config_map_projection.set_items(key_to_paths); + let config_map_projection_clone = config_map_projection.clone(); + assert_eq!(config_map_projection.into_kube(), config_map_projection_clone.into_kube()); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/configmap_volume_source.rs b/src/unit_tests/kubernetes_api_objects/configmap_volume_source.rs new file mode 100644 index 000000000..c3adcfaf4 --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/configmap_volume_source.rs @@ -0,0 +1,28 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for config map volume source +#[test] +#[verifier(external)] +pub fn test_default() { + let config_map_volume_source = ConfigMapVolumeSource::default(); + assert_eq!(config_map_volume_source.into_kube(), deps_hack::k8s_openapi::api::core::v1::ConfigMapVolumeSource::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_name() { + let mut config_map_volume_source = ConfigMapVolumeSource::default(); + config_map_volume_source.set_name(new_strlit("name").to_string()); + assert_eq!("name".to_string(), config_map_volume_source.into_kube().name.unwrap()); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/downwardapi_volume_file.rs b/src/unit_tests/kubernetes_api_objects/downwardapi_volume_file.rs new file mode 100644 index 000000000..14cbde286 --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/downwardapi_volume_file.rs @@ -0,0 +1,33 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for downwardAPI volume file +#[test] +#[verifier(external)] +pub fn test_default() { + let downward_api_volume_file = DownwardAPIVolumeFile::default(); + assert_eq!(downward_api_volume_file.into_kube(), deps_hack::k8s_openapi::api::core::v1::DownwardAPIVolumeFile::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_field_ref() { + let mut downward_api_volume_file = DownwardAPIVolumeFile::default(); + let mut object_field_selector = ObjectFieldSelector::default(); + object_field_selector.set_field_path(new_strlit("field_path").to_string()); + downward_api_volume_file.set_field_ref(object_field_selector.clone()); + assert_eq!( + object_field_selector.into_kube(), + downward_api_volume_file.into_kube().field_ref.unwrap() + ); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/downwardapi_volume_source.rs b/src/unit_tests/kubernetes_api_objects/downwardapi_volume_source.rs new file mode 100644 index 000000000..a8d234774 --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/downwardapi_volume_source.rs @@ -0,0 +1,44 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for downwardAPI volume source +#[test] +#[verifier(external)] +pub fn test_default() { + let downward_api_volume_source = DownwardAPIVolumeSource::default(); + assert_eq!(downward_api_volume_source.into_kube(), deps_hack::k8s_openapi::api::core::v1::DownwardAPIVolumeSource::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_items() { + let mut downward_api_volume_source = DownwardAPIVolumeSource::default(); + let downward_api_volume_file_gen = || { + let mut downward_api_volume_file_1 = DownwardAPIVolumeFile::default(); + let mut downward_api_volume_file_2 = DownwardAPIVolumeFile::default(); + let mut downward_api_volume_files = Vec::new(); + downward_api_volume_file_1.set_path(new_strlit("path1").to_string()); + downward_api_volume_file_2.set_path(new_strlit("path2").to_string()); + downward_api_volume_files.push(downward_api_volume_file_1); + downward_api_volume_files.push(downward_api_volume_file_2); + downward_api_volume_files + }; + downward_api_volume_source.set_items(downward_api_volume_file_gen()); + assert_eq!( + downward_api_volume_file_gen() + .into_iter() + .map(|s: DownwardAPIVolumeFile| s.into_kube()) + .collect::>(), + downward_api_volume_source.into_kube().items.unwrap() + ); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/empty_dir_volume_source.rs b/src/unit_tests/kubernetes_api_objects/empty_dir_volume_source.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/unit_tests/kubernetes_api_objects/hostpath_volume_source.rs b/src/unit_tests/kubernetes_api_objects/hostpath_volume_source.rs new file mode 100644 index 000000000..bcf93161f --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/hostpath_volume_source.rs @@ -0,0 +1,28 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for host path volume source +#[test] +#[verifier(external)] +pub fn test_default() { + let host_path_volume_source = HostPathVolumeSource::default(); + assert_eq!(host_path_volume_source.into_kube(), deps_hack::k8s_openapi::api::core::v1::HostPathVolumeSource::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_path() { + let mut host_path_volume_source = HostPathVolumeSource::default(); + host_path_volume_source.set_path(new_strlit("path").to_string()); + assert_eq!("path".to_string(), host_path_volume_source.into_kube().path); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/key_to_path.rs b/src/unit_tests/kubernetes_api_objects/key_to_path.rs new file mode 100644 index 000000000..f4153665d --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/key_to_path.rs @@ -0,0 +1,36 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for key to path +#[test] +#[verifier(external)] +pub fn test_default() { + let key_to_path = KeyToPath::default(); + assert_eq!(key_to_path.into_kube(), deps_hack::k8s_openapi::api::core::v1::KeyToPath::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_key() { + let mut key_to_path = KeyToPath::default(); + key_to_path.set_key(new_strlit("key").to_string()); + assert_eq!("key".to_string(), key_to_path.into_kube().key); +} + +#[test] +#[verifier(external)] +pub fn test_set_path() { + let mut key_to_path = KeyToPath::default(); + key_to_path.set_path(new_strlit("path").to_string()); + assert_eq!("path".to_string(), key_to_path.into_kube().path); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/mod.rs b/src/unit_tests/kubernetes_api_objects/mod.rs index 2fac8f1d9..ced5a7f50 100644 --- a/src/unit_tests/kubernetes_api_objects/mod.rs +++ b/src/unit_tests/kubernetes_api_objects/mod.rs @@ -1,10 +1,16 @@ // Copyright 2022 VMware, Inc. // SPDX-License-Identifier: MIT pub mod config_map; +pub mod configmap_projection; +pub mod configmap_volume_source; pub mod container; +pub mod downwardapi_volume_file; +pub mod downwardapi_volume_source; +pub mod empty_dir_volume_source; pub mod env_var; pub mod env_var_source; pub mod execaction; +pub mod hostpath_volume_source; pub mod lifecycle; pub mod lifecycle_handler; pub mod object_field_selector; @@ -13,6 +19,12 @@ pub mod pod; pub mod pod_spec; pub mod pod_template_spec; pub mod probe; +pub mod projected_volume_source; pub mod resource_requirements; +pub mod secret_projection; +pub mod secret_volume_source; pub mod tcp_socket_action; +pub mod volume; pub mod volume_mount; +pub mod volume_projection; +pub mod key_to_path; \ No newline at end of file diff --git a/src/unit_tests/kubernetes_api_objects/projected_volume_source.rs b/src/unit_tests/kubernetes_api_objects/projected_volume_source.rs new file mode 100644 index 000000000..b69ca76b9 --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/projected_volume_source.rs @@ -0,0 +1,44 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for projected volume source +#[test] +#[verifier(external)] +pub fn test_default() { + let projected_volume_source = ProjectedVolumeSource::default(); + assert_eq!(projected_volume_source.into_kube(), deps_hack::k8s_openapi::api::core::v1::ProjectedVolumeSource::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_resources() { + let mut projected_volume_source = ProjectedVolumeSource::default(); + let volume_projections_gen = || { + let mut volume_projection_1 = VolumeProjection::default(); + let mut volume_projection_2 = VolumeProjection::default(); + let mut volume_projections = Vec::new(); + volume_projection_1.set_config_map(ConfigMapProjection::default()); + volume_projection_2.set_secret(SecretProjection::default()); + volume_projections.push(volume_projection_1); + volume_projections.push(volume_projection_2); + volume_projections + }; + projected_volume_source.set_sources(volume_projections_gen()); + assert_eq!( + volume_projections_gen() + .into_iter() + .map(|s: VolumeProjection| s.into_kube()) + .collect::>(), + projected_volume_source.into_kube().sources.unwrap() + ); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/secret_projection.rs b/src/unit_tests/kubernetes_api_objects/secret_projection.rs new file mode 100644 index 000000000..c10bb0af0 --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/secret_projection.rs @@ -0,0 +1,54 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for scret projection +#[test] +#[verifier(external)] +pub fn test_default() { + let secret_projection = SecretProjection::default(); + assert_eq!(secret_projection.into_kube(), deps_hack::k8s_openapi::api::core::v1::SecretProjection::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_name() { + let mut secret_projection = SecretProjection::default(); + secret_projection.set_name(new_strlit("name").to_string()); + assert_eq!("name".to_string(), secret_projection.into_kube().name.unwrap()); +} + +#[test] +#[verifier(external)] +pub fn test_set_items() { + let mut secret_projection = SecretProjection::default(); + let key_to_paths_gen = || { + let mut key_to_path_1 = KeyToPath::default(); + let mut key_to_path_2 = KeyToPath::default(); + let mut key_to_paths = Vec::new(); + key_to_path_1.set_key(new_strlit("key1").to_string()); + key_to_path_1.set_path(new_strlit("path1").to_string()); + key_to_path_2.set_key(new_strlit("key2").to_string()); + key_to_path_2.set_path(new_strlit("path2").to_string()); + key_to_paths.push(key_to_path_1); + key_to_paths.push(key_to_path_2); + key_to_paths + }; + secret_projection.set_items(key_to_paths_gen()); + assert_eq!( + key_to_paths_gen() + .into_iter() + .map(|s: KeyToPath| s.into_kube()) + .collect::>(), + secret_projection.into_kube().items.unwrap() + ); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/secret_volume_source.rs b/src/unit_tests/kubernetes_api_objects/secret_volume_source.rs new file mode 100644 index 000000000..590906fd8 --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/secret_volume_source.rs @@ -0,0 +1,29 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for secret volume source +#[test] +#[verifier(external)] +pub fn test_default() { + let secret_volume_source = SecretVolumeSource::default(); + assert_eq!(secret_volume_source.into_kube(), deps_hack::k8s_openapi::api::core::v1::SecretVolumeSource::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_secret_name() { + let mut secret_volume_source = SecretVolumeSource::default(); + secret_volume_source.set_secret_name(new_strlit("secret_name").to_string()); + assert_eq!("secret_name".to_string(), secret_volume_source.into_kube().secret_name.unwrap()); +} + +} diff --git a/src/unit_tests/kubernetes_api_objects/volume.rs b/src/unit_tests/kubernetes_api_objects/volume.rs new file mode 100644 index 000000000..62cea0c2a --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/volume.rs @@ -0,0 +1,43 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for volume +#[test] +#[verifier(external)] +pub fn test_default() { + let volume = Volume::default(); + assert_eq!(volume.into_kube(), deps_hack::k8s_openapi::api::core::v1::Volume::default()); +} + +#[test] +#[verifier(external)] +pub fn test_clone() { + let mut volume = Volume::default(); + let mut host_path_volume_source = HostPathVolumeSource::default(); + host_path_volume_source.set_path(new_strlit("path").to_string()); + volume.set_host_path(host_path_volume_source); + let volume_clone = volume.clone(); + assert_eq!(volume.into_kube(), volume_clone.into_kube()); +} + +#[test] +#[verifier(external)] +pub fn test_set_name() { + let mut volume = Volume::default(); + volume.set_name(new_strlit("name").to_string()); + assert_eq!("name".to_string(), volume.into_kube().name); + + let mut volume = Volume::default(); + volume.set_name(new_strlit("").to_string()); + assert_eq!("".to_string(), volume.into_kube().name); +} +} diff --git a/src/unit_tests/kubernetes_api_objects/volume_projection.rs b/src/unit_tests/kubernetes_api_objects/volume_projection.rs new file mode 100644 index 000000000..2993c26da --- /dev/null +++ b/src/unit_tests/kubernetes_api_objects/volume_projection.rs @@ -0,0 +1,39 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: MIT +use crate::kubernetes_api_objects::container::*; +use crate::kubernetes_api_objects::object_meta::*; +use crate::kubernetes_api_objects::pod::*; +use crate::kubernetes_api_objects::resource::*; +use crate::kubernetes_api_objects::volume::*; +use crate::vstd_ext::string_map::*; +use vstd::prelude::*; +use vstd::string::*; + +verus! { +// Tests for volume projecion +#[test] +#[verifier(external)] +pub fn test_default() { + let volume_projection = VolumeProjection::default(); + assert_eq!(volume_projection.into_kube(), deps_hack::k8s_openapi::api::core::v1::VolumeProjection::default()); +} + +#[test] +#[verifier(external)] +pub fn test_set_config_map() { + let mut volume_projection = VolumeProjection::default(); + let mut config_map_projection = ConfigMapProjection::default(); + config_map_projection.set_name(new_strlit("name").to_string()); + volume_projection.set_config_map(config_map_projection.clone()); + assert_eq!(config_map_projection.into_kube(), volume_projection.into_kube().config_map.unwrap()); +} + +#[test] +pub fn test_set_secrets() { + let mut volume_projection = VolumeProjection::default(); + let mut secret_projection = SecretProjection::default(); + secret_projection.set_name(new_strlit("name").to_string()); + volume_projection.set_secret(secret_projection.clone()); + assert_eq!(secret_projection.into_kube(), volume_projection.into_kube().secret.unwrap()); +} +}