|
1 | 1 | use std::collections::HashSet;
|
2 | 2 |
|
3 | 3 | use k8s_openapi::chrono::{SecondsFormat, Utc};
|
4 |
| -use kube::{api::ObjectMeta, CustomResource, ResourceExt}; |
| 4 | +use kube::{CustomResource, ResourceExt, api::ObjectMeta}; |
5 | 5 |
|
6 | 6 | use schemars::JsonSchema;
|
7 | 7 | use serde::{Deserialize, Serialize};
|
@@ -434,33 +434,49 @@ mod tests {
|
434 | 434 | };
|
435 | 435 |
|
436 | 436 | // Do not overwrite source (same name & namespace)
|
437 |
| - assert!(all_namespaces |
438 |
| - .applies_to(&obj, "source_namespace") |
439 |
| - .is_none()); |
440 |
| - assert!(source_namespace |
441 |
| - .applies_to(&obj, "source_namespace") |
442 |
| - .is_none()); |
| 437 | + assert!( |
| 438 | + all_namespaces |
| 439 | + .applies_to(&obj, "source_namespace") |
| 440 | + .is_none() |
| 441 | + ); |
| 442 | + assert!( |
| 443 | + source_namespace |
| 444 | + .applies_to(&obj, "source_namespace") |
| 445 | + .is_none() |
| 446 | + ); |
443 | 447 | // Apply if not source but same namespace
|
444 |
| - assert!(all_namespaces_other_name |
445 |
| - .applies_to(&obj, "source_namespace") |
446 |
| - .is_some()); |
447 |
| - assert!(source_namespace_other_name |
448 |
| - .applies_to(&obj, "source_namespace") |
449 |
| - .is_some()); |
| 448 | + assert!( |
| 449 | + all_namespaces_other_name |
| 450 | + .applies_to(&obj, "source_namespace") |
| 451 | + .is_some() |
| 452 | + ); |
| 453 | + assert!( |
| 454 | + source_namespace_other_name |
| 455 | + .applies_to(&obj, "source_namespace") |
| 456 | + .is_some() |
| 457 | + ); |
450 | 458 | // Apply if different namespace
|
451 | 459 | assert!(all_namespaces.applies_to(&obj, "other_namespace").is_some());
|
452 |
| - assert!(other_namespace |
453 |
| - .applies_to(&obj, "other_namespace") |
454 |
| - .is_some()); |
455 |
| - assert!(all_namespaces_other_name |
456 |
| - .applies_to(&obj, "other_namespace") |
457 |
| - .is_some()); |
| 460 | + assert!( |
| 461 | + other_namespace |
| 462 | + .applies_to(&obj, "other_namespace") |
| 463 | + .is_some() |
| 464 | + ); |
| 465 | + assert!( |
| 466 | + all_namespaces_other_name |
| 467 | + .applies_to(&obj, "other_namespace") |
| 468 | + .is_some() |
| 469 | + ); |
458 | 470 | // Refuse if destination namespace does not match
|
459 |
| - assert!(source_namespace_other_name |
460 |
| - .applies_to(&obj, "other_namespace") |
461 |
| - .is_none()); |
462 |
| - assert!(other_namespace |
463 |
| - .applies_to(&obj, "source_namespace") |
464 |
| - .is_none()); |
| 471 | + assert!( |
| 472 | + source_namespace_other_name |
| 473 | + .applies_to(&obj, "other_namespace") |
| 474 | + .is_none() |
| 475 | + ); |
| 476 | + assert!( |
| 477 | + other_namespace |
| 478 | + .applies_to(&obj, "source_namespace") |
| 479 | + .is_none() |
| 480 | + ); |
465 | 481 | }
|
466 | 482 | }
|
0 commit comments