Skip to content

Commit

Permalink
setup integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrtc committed Feb 11, 2024
1 parent 8efd083 commit 73d0589
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use log::info;
use log::LevelFilter::Debug;
use std::io::Write;

pub fn setup() -> anyhow::Result<()> {
env_logger::Builder::new()
.format(|buf, record| {
writeln!(
buf,
"{}:{} [{}] {} - {}",
record.file().unwrap_or("unknown"),
record.line().unwrap_or(0),
record.level(),
chrono::Local::now().format("%H:%M:%S.%6f"),
record.args()
)
})
.filter(None, Debug)
.try_init()?;

// some setup code, like creating required files/directories, starting
// servers, etc.
info!("common setup");

Ok(())
}
10 changes: 10 additions & 0 deletions tests/datachannel_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// importing common module.
mod common;

#[test]
fn test_datachannel() -> anyhow::Result<()> {
// using common code.
common::setup()?;

Ok(())
}
10 changes: 10 additions & 0 deletions tests/rtcp_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// importing common module.
mod common;

#[test]
fn test_rtcp() -> anyhow::Result<()> {
// using common code.
common::setup()?;

Ok(())
}
10 changes: 10 additions & 0 deletions tests/rtp_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// importing common module.
mod common;

#[test]
fn test_rtp() -> anyhow::Result<()> {
// using common code.
common::setup()?;

Ok(())
}
10 changes: 10 additions & 0 deletions tests/signaling_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// importing common module.
mod common;

#[test]
fn test_signaling() -> anyhow::Result<()> {
// using common code.
common::setup()?;

Ok(())
}

0 comments on commit 73d0589

Please sign in to comment.