-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add recording logger for further tests
- Loading branch information
Showing
5 changed files
with
76 additions
and
7 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
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
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,38 @@ | ||
#![allow(dead_code)] | ||
|
||
use crate::utils::RecordingLogger; | ||
use configcat::OverrideBehavior::LocalOnly; | ||
use configcat::{Client, FileDataSource}; | ||
use log::set_max_level; | ||
|
||
mod utils; | ||
|
||
fn init() { | ||
set_max_level(log::LevelFilter::Info); | ||
_ = log::set_logger(&RecordingLogger {}); | ||
} | ||
|
||
#[tokio::test] | ||
async fn prerequisite_circular_deps() { | ||
init(); | ||
|
||
let tests = vec![ | ||
("key1", "'key1' -> 'key1'"), | ||
("key2", "'key2' -> 'key3' -> 'key2'"), | ||
("key4", "'key4' -> 'key3' -> 'key2' -> 'key3'"), | ||
]; | ||
|
||
let client = Client::builder("local") | ||
.overrides( | ||
Box::new(FileDataSource::new("tests/data/test_circulardependency_v6.json").unwrap()), | ||
LocalOnly, | ||
) | ||
.build() | ||
.unwrap(); | ||
|
||
for test in tests { | ||
_ = client.get_flag_details(test.0, None).await; | ||
let logs = RecordingLogger::LOGS.take(); | ||
assert!(logs.contains(test.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
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