Skip to content

Commit

Permalink
Removing moby check (#5905)
Browse files Browse the repository at this point in the history
As per discussion with moby team, we are removing the check for moby in iotedge because we won't be able to rely on "+azure" in the version forever.

## Azure IoT Edge PR checklist:
  • Loading branch information
huguesBouvier authored Dec 9, 2021
1 parent 17541cc commit 3b95ec7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 191 deletions.
71 changes: 0 additions & 71 deletions edgelet/iotedge/src/check/checks/container_engine_is_moby.rs

This file was deleted.

3 changes: 0 additions & 3 deletions edgelet/iotedge/src/check/checks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod container_connect_upstream;
mod container_engine_dns;
mod container_engine_installed;
mod container_engine_ipv6;
mod container_engine_is_moby;
mod container_engine_logrotate;
mod container_local_time;
mod container_resolve_parent_hostname;
Expand All @@ -21,7 +20,6 @@ pub(crate) use self::container_connect_upstream::get_host_container_upstream_tes
pub(crate) use self::container_engine_dns::ContainerEngineDns;
pub(crate) use self::container_engine_installed::ContainerEngineInstalled;
pub(crate) use self::container_engine_ipv6::ContainerEngineIPv6;
pub(crate) use self::container_engine_is_moby::ContainerEngineIsMoby;
pub(crate) use self::container_engine_logrotate::ContainerEngineLogrotate;
pub(crate) use self::container_local_time::ContainerLocalTime;
pub(crate) use self::container_resolve_parent_hostname::ContainerResolveParentHostname;
Expand Down Expand Up @@ -87,7 +85,6 @@ pub(crate) fn built_in_checks() -> [(&'static str, Vec<Box<dyn Checker>>); 2] {
Box::new(ContainerLocalTime::default()),
Box::new(ContainerEngineDns::default()),
Box::new(ContainerEngineIPv6::default()),
Box::new(ContainerEngineIsMoby::default()),
Box::new(ContainerEngineLogrotate::default()),
Box::new(EdgeAgentStorageMounted::default()),
Box::new(EdgeHubStorageMounted::default()),
Expand Down
118 changes: 1 addition & 117 deletions edgelet/iotedge/src/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,7 @@ fn write_lines<'a>(

#[cfg(test)]
mod tests {
use super::{
checks::{ContainerEngineIsMoby, WellFormedConfig},
Check, CheckResult, Checker,
};
use super::{checks::WellFormedConfig, Check, CheckResult, Checker};

lazy_static::lazy_static! {
static ref ENV_LOCK: tokio::sync::Mutex<()> = Default::default();
Expand Down Expand Up @@ -713,64 +710,6 @@ mod tests {
CheckResult::Ok => (),
check_result => panic!("parsing {} returned {:?}", filename, check_result),
}

// Pretend it's Moby
check.docker_server_version = Some("19.03.12+azure".to_owned());

match ContainerEngineIsMoby::default().execute(&mut check).await {
CheckResult::Ok => (),
check_result => panic!(
"checking moby_runtime.uri in {} returned {:?}",
filename, check_result
),
}
}
}

#[tokio::test]
async fn config_file_checks_ok_old_moby() {
for filename in &["sample_settings.toml", "sample_settings.tg.filepaths.toml"] {
let _env_lock = ENV_LOCK.lock().await;

std::env::set_var(
"AZIOT_EDGED_CONFIG",
format!(
"{}/../edgelet-settings/test-files/{}",
env!("CARGO_MANIFEST_DIR"),
filename,
),
);

let mut check = Check::new(
"daemon.json".into(), // unused for this test
"mcr.microsoft.com/azureiotedge-diagnostics:1.0.0".to_owned(), // unused for this test
Default::default(),
Some("1.0.0".to_owned()), // unused for this test
Some("1.0.0".to_owned()), // unused for this test
"aziot-edged".into(), // unused for this test
super::OutputFormat::Text, // unused for this test
false,
false,
"".into(), // unused for this test
None,
None,
);

match WellFormedConfig::default().execute(&mut check).await {
CheckResult::Ok => (),
check_result => panic!("parsing {} returned {:?}", filename, check_result),
}

// Pretend it's Moby
check.docker_server_version = Some("3.0.3".to_owned());

match ContainerEngineIsMoby::default().execute(&mut check).await {
CheckResult::Ok => (),
check_result => panic!(
"checking moby_runtime.uri in {} returned {:?}",
filename, check_result
),
}
}
}

Expand Down Expand Up @@ -810,61 +749,6 @@ mod tests {
}
}

#[tokio::test]
async fn moby_runtime_uri_wants_moby_based_on_server_version() {
let filename = "sample_settings.toml";

let _env_lock = ENV_LOCK.lock().await;

std::env::set_var(
"AZIOT_EDGED_CONFIG",
format!(
"{}/../edgelet-settings/test-files/{}",
env!("CARGO_MANIFEST_DIR"),
filename,
),
);

let mut check = super::Check::new(
"daemon.json".into(), // unused for this test
"mcr.microsoft.com/azureiotedge-diagnostics:1.0.0".to_owned(), // unused for this test
Default::default(),
Some("1.0.0".to_owned()), // unused for this test
Some("1.0.0".to_owned()), // unused for this test
"aziot-edged".into(), // unused for this test
super::OutputFormat::Text, // unused for this test
false,
false,
"".into(), // unused for this test
None,
None,
);

match WellFormedConfig::default().execute(&mut check).await {
CheckResult::Ok => (),
check_result => panic!("parsing {} returned {:?}", filename, check_result),
}

// Pretend it's Docker
check.docker_server_version = Some("19.03.12".to_owned());

match ContainerEngineIsMoby::default().execute(&mut check).await {
CheckResult::Warning(warning) => assert!(
warning.to_string().contains(
"Device is not using a production-supported container engine (moby-engine)."
),
"checking moby_runtime.uri in {} failed with an unexpected warning: {}",
filename,
warning
),

check_result => panic!(
"checking moby_runtime.uri in {} returned {:?}",
filename, check_result
),
}
}

#[tokio::test]
#[allow(clippy::semicolon_if_nothing_returned)]
async fn pickup_proxy_uri_from_the_right_place() {
Expand Down

0 comments on commit 3b95ec7

Please sign in to comment.