-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helper: Add develp with test using webrtc and task count
Signed-off-by: Patrick José Pereira <[email protected]>
- Loading branch information
1 parent
99ea408
commit 73fa81e
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use crate::helper; | ||
use core::time::Duration; | ||
use std::thread; | ||
use thirtyfour::prelude::*; | ||
use tokio::runtime::Runtime; | ||
use tracing::*; | ||
|
||
pub fn start_check_tasks_on_webrtc_reconnects() { | ||
let mut counter = 0; | ||
thread::spawn(move || { | ||
let rt = Runtime::new().unwrap(); | ||
rt.block_on(async move { | ||
info!("Started webrtc test.."); | ||
let mut caps = DesiredCapabilities::chrome(); | ||
let _ = caps.set_headless(); | ||
let driver = WebDriver::new("http://localhost:9515", caps) | ||
.await | ||
.expect("Failed to create web driver."); | ||
driver | ||
.goto("http://0.0.0.0:6020/webrtc/index.html") | ||
.await | ||
.expect("Failed to connect to local webrtc page."); | ||
loop { | ||
for button in ["add-consumer", "add-session", "remove-all-consumers"] { | ||
thread::sleep(Duration::from_secs(3)); | ||
driver | ||
.find(By::Id(button)) | ||
.await | ||
.unwrap() | ||
.click() | ||
.await | ||
.unwrap(); | ||
} | ||
counter += 1; | ||
info!("Restarted webrtc {} times", counter); | ||
if helper::threads::process_task_counter() > 100 { | ||
error!("Thead leak detected!"); | ||
std::process::exit(-1); | ||
} | ||
} | ||
}); | ||
error!("Webrtc test failed internally."); | ||
std::process::exit(-1); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#[macro_use] | ||
pub mod develop; | ||
pub mod macros; | ||
pub mod threads; |