mirror of
https://github.com/telemt/telemt.git
synced 2026-10-12 04:15:59 +03:00
Direct-since-epoch
This commit is contained in:
+31
-2
@@ -17,8 +17,8 @@ use crate::config::{
|
||||
use crate::maestro::generation::test_runtime_generation;
|
||||
use crate::web::frame::{self, FrameType};
|
||||
use crate::web::manager::{
|
||||
CloseOperationSelector, ControlError, SessionDetail, SessionFilter, SessionListRequest,
|
||||
SessionRefError, WebProcessRuntime,
|
||||
CloseOperationSelector, ControlError, ManagerError, SessionDetail, SessionFilter,
|
||||
SessionListRequest, SessionRefError, WebProcessRuntime,
|
||||
};
|
||||
|
||||
#[path = "legacy_tests.rs"]
|
||||
@@ -433,6 +433,35 @@ async fn bridge_bootstrap_uses_the_generation_that_selected_its_profile() {
|
||||
replacement.stop_background_tasks().await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn stale_generation_cannot_publish_bootstrap_after_disabled_cutover() {
|
||||
let capability = [23u8; 32];
|
||||
let initial = test_runtime_generation(1, runtime_config(capability, WebCarrier::Https));
|
||||
let active_runtime = Arc::new(ArcSwap::from(Arc::clone(&initial)));
|
||||
let runtime = WebProcessRuntime::start(active_runtime);
|
||||
let profile = initial.config().web.runtime.as_ref().unwrap().profiles[0].clone();
|
||||
let mut disabled_config = runtime_config(capability, WebCarrier::Https);
|
||||
disabled_config.web.enabled = false;
|
||||
let disabled = test_runtime_generation(2, disabled_config);
|
||||
|
||||
runtime.activate_generation(Arc::clone(&disabled));
|
||||
let result = runtime.issue_bootstrap_for_generation(
|
||||
&initial,
|
||||
profile,
|
||||
"192.0.2.10".parse().unwrap(),
|
||||
);
|
||||
|
||||
assert!(matches!(result, Err(ManagerError::Closed)));
|
||||
let status = serde_json::to_value(runtime.try_status()).unwrap();
|
||||
assert_eq!(status["manager"]["bootstraps"], 0);
|
||||
|
||||
runtime.shutdown().await;
|
||||
initial.stop_sessions().await;
|
||||
initial.stop_background_tasks().await;
|
||||
disabled.stop_sessions().await;
|
||||
disabled.stop_background_tasks().await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unused_bootstrap_is_rejected_after_profile_identity_change() {
|
||||
let capability = [11u8; 32];
|
||||
|
||||
@@ -102,7 +102,7 @@ impl WebProcessRuntime {
|
||||
self.record_limit_hit();
|
||||
self.telemetry
|
||||
.record_rejection(WebRejectionReason::RuntimeClosed);
|
||||
return Err(ManagerError::Limit);
|
||||
return Err(ManagerError::Closed);
|
||||
}
|
||||
if state
|
||||
.bootstraps_per_ip
|
||||
|
||||
Reference in New Issue
Block a user