uptime-graph details, hover, history and % uptime overall

This commit is contained in:
4cuck committed 2023-10-16 23:32:09 +02:00
1 parent df316e8fdd
commit daee7e6277
5 files changed
+127 -48

No files matched your search

+24
View File
@@ -412,10 +412,13 @@ impl Scanner {
#[cfg(test)]
mod test {
use super::*;
use chrono::Duration;
use entities::state::scanner::Config;
use sea_orm::{ConnectOptions, Database};
use tokio::{fs::File, io::AsyncWriteExt};
use entities::health_check;
async fn db_init() -> DatabaseConnection {
Database::connect(ConnectOptions::new(
@@ -425,6 +428,27 @@ mod test {
.unwrap()
}
// only for generating fake data
// still requires copying over the DB for running on it
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
#[ignore]
async fn setup_test_data() {
let db = db_init().await;
let time: chrono::DateTime<Utc> = Utc::now();
for v in 0..365 {
let entry_time = time.checked_sub_signed(Duration::minutes(15*v)).unwrap();
health_check::ActiveModel {
time: ActiveValue::Set(entry_time.timestamp()),
host: ActiveValue::Set(208692),
resp_time: ActiveValue::Set(Some(12)),
healthy: ActiveValue::Set(v % 2 == 0),
response_code: ActiveValue::Set(Some(200)),
}
.insert(&db)
.await.unwrap();
}
}
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
#[ignore]
async fn update_instacelist() {