Merge pull request 'fix: added missing functions to impl SwitchClient for unmanagedSwitch' (#203) from fix/brocade_unmaged_switch into master
Reviewed-on: #203
This commit is contained in:
@@ -1222,9 +1222,11 @@ fn extract_base_domain(host: &str) -> Option<String> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
static TEST_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||
static ENV_LOCK: Mutex<()> = Mutex::new(());
|
||||
|
||||
/// Sets environment variables with unique names to avoid concurrency issues between tests.
|
||||
/// Returns the names of the (config_var, profile_var) used.
|
||||
@@ -1289,6 +1291,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_remote_k8s_from_env_var_only_context() {
|
||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
run_in_isolated_env(|| {
|
||||
unsafe {
|
||||
std::env::remove_var("KUBECONFIG");
|
||||
@@ -1305,6 +1308,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_remote_k8s_from_env_var_unknown_key_trim() {
|
||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
run_in_isolated_env(|| {
|
||||
unsafe {
|
||||
std::env::remove_var("KUBECONFIG");
|
||||
@@ -1324,6 +1328,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_remote_k8s_from_env_var_empty_malformed() {
|
||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
run_in_isolated_env(|| {
|
||||
unsafe {
|
||||
std::env::remove_var("KUBECONFIG");
|
||||
@@ -1341,6 +1346,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_remote_k8s_from_env_var_kubeconfig_fallback() {
|
||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
run_in_isolated_env(|| {
|
||||
unsafe {
|
||||
std::env::set_var("KUBECONFIG", "/fallback/path");
|
||||
@@ -1357,6 +1363,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_remote_k8s_from_env_var_kubeconfig_no_fallback_if_provided() {
|
||||
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
run_in_isolated_env(|| {
|
||||
unsafe {
|
||||
std::env::set_var("KUBECONFIG", "/fallback/path");
|
||||
|
||||
@@ -139,7 +139,7 @@ impl SwitchClient for BrocadeSwitchClient {
|
||||
pub struct UnmanagedSwitch;
|
||||
|
||||
impl UnmanagedSwitch {
|
||||
pub async fn init( ) -> Result<Self, ()> {
|
||||
pub async fn init() -> Result<Self, ()> {
|
||||
Ok(Self)
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,14 @@ impl SwitchClient for UnmanagedSwitch {
|
||||
channel_name: &str,
|
||||
switch_ports: Vec<PortLocation>,
|
||||
) -> Result<u8, SwitchError> {
|
||||
todo!("unmanaged switch. Nothing to do.")
|
||||
todo!("unmanaged switch. Nothing to do.")
|
||||
}
|
||||
|
||||
async fn clear_port_channel(&self, ids: &Vec<Id>) -> Result<(), SwitchError> {
|
||||
todo!("unmanged switch. Nothing to do.")
|
||||
}
|
||||
async fn configure_interface(&self, ports: &Vec<PortConfig>) -> Result<(), SwitchError> {
|
||||
todo!("unmanged switch. Nothing to do.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user