-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
use blockscout_service_launcher::{ | ||
launcher::ConfigSettings, | ||
test_server::{get_test_server_settings, init_server, send_get_request}, | ||
}; | ||
use chrono::NaiveDate; | ||
use stats::tests::{init_db::init_db_all, mock_blockscout::fill_mock_blockscout_data}; | ||
use stats_proto::blockscout::stats::v1::Counters; | ||
use stats_server::{stats, Settings}; | ||
use std::{collections::HashSet, path::PathBuf, str::FromStr}; | ||
|
||
#[tokio::test] | ||
#[ignore = "needs database"] | ||
async fn test_swagger_ok() { | ||
let (stats_db, blockscout_db) = init_db_all("test_swagger_ok").await; | ||
std::env::set_var("STATS__CONFIG", "./tests/config/test.toml"); | ||
let mut settings = Settings::build().expect("Failed to build settings"); | ||
let (server_settings, base) = get_test_server_settings(); | ||
settings.server = server_settings; | ||
settings.charts_config = PathBuf::from_str("../config/charts.json").unwrap(); | ||
settings.layout_config = PathBuf::from_str("../config/layout.json").unwrap(); | ||
settings.update_groups_config = PathBuf::from_str("../config/update_groups.json").unwrap(); | ||
settings.db_url = stats_db.db_url(); | ||
settings.blockscout_db_url = blockscout_db.db_url(); | ||
|
||
init_server(|| stats(settings), &base).await; | ||
|
||
// Sleep until server will start and calculate all values | ||
tokio::time::sleep(std::time::Duration::from_secs(5)).await; | ||
|
||
let request = reqwest::Client::new().request( | ||
reqwest::Method::GET, | ||
base.join("/api/v1/docs/swagger.yaml").unwrap(), | ||
); | ||
let response = request | ||
.send() | ||
.await | ||
.unwrap_or_else(|_| panic!("Failed to send request")); | ||
|
||
println!("{:?}", response); | ||
println!("{}", response.text().await.unwrap()); | ||
panic!(); | ||
} |