Skip to content

Commit

Permalink
fix: tests. Missing new image cache section in config
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed May 4, 2023
1 parent 7cd0cb2 commit 88bd598
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 4 deletions.
7 changes: 7 additions & 0 deletions config-idx-back.toml.local
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ username = ""
password = ""
server = "mailcatcher"
port = 1025

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000
9 changes: 8 additions & 1 deletion config.toml.local
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ max_password_length = 64
secret_key = "MaxVerstappenWC2021"

[database]
connect_url = "sqlite://storage/database/data.db?mode=rwc"
connect_url = "sqlite://data.db?mode=rwc"
torrent_info_update_interval = 3600

[mail]
Expand All @@ -29,3 +29,10 @@ username = ""
password = ""
server = ""
port = 25

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000
10 changes: 10 additions & 0 deletions tests/common/contexts/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct Settings {
pub auth: Auth,
pub database: Database,
pub mail: Mail,
pub image_cache: ImageCache,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
Expand Down Expand Up @@ -57,3 +58,12 @@ pub struct Mail {
pub server: String,
pub port: u64,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct ImageCache {
pub max_request_timeout_ms: u64,
pub capacity: u64,
pub entry_size_limit: u64,
pub user_quota_period_seconds: u64,
pub user_quota_bytes: u64,
}
18 changes: 16 additions & 2 deletions tests/e2e/contexts/settings/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::common::client::Client;
use crate::common::contexts::settings::form::UpdateSettingsForm;
use crate::common::contexts::settings::responses::{AllSettingsResponse, Public, PublicSettingsResponse, SiteNameResponse};
use crate::common::contexts::settings::{Auth, Database, Mail, Net, Settings, Tracker, Website};
use crate::common::contexts::settings::{Auth, Database, ImageCache, Mail, Net, Settings, Tracker, Website};
use crate::e2e::contexts::user::steps::new_logged_in_admin;
use crate::e2e::environment::TestEnv;

Expand Down Expand Up @@ -112,6 +112,13 @@ async fn it_should_allow_admins_to_update_all_the_settings() {
server: "mailcatcher".to_string(),
port: 1025,
},
image_cache: ImageCache {
max_request_timeout_ms: 1000,
capacity: 128_000_000,
entry_size_limit: 4_000_000,
user_quota_period_seconds: 3600,
user_quota_bytes: 64_000_000,
},
})
.await;

Expand Down Expand Up @@ -152,7 +159,14 @@ async fn it_should_allow_admins_to_update_all_the_settings() {
password: String::new(),
server: "mailcatcher".to_string(),
port: 1025,
}
},
image_cache: ImageCache {
max_request_timeout_ms: 1000,
capacity: 128_000_000,
entry_size_limit: 4_000_000,
user_quota_period_seconds: 3600,
user_quota_bytes: 64_000_000,
},
}
);
if let Some(content_type) = &response.content_type {
Expand Down
16 changes: 15 additions & 1 deletion tests/e2e/environment.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::env;

use crate::common::contexts::settings::{Auth, Database, Mail, Net, Settings, Tracker, Website};
use crate::common::contexts::settings::{Auth, Database, ImageCache, Mail, Net, Settings, Tracker, Website};
use crate::environments::{self, isolated, shared};

enum State {
Expand Down Expand Up @@ -128,6 +128,13 @@ impl TestEnv {
server: "mailcatcher".to_string(),
port: 1025,
},
image_cache: ImageCache {
max_request_timeout_ms: 1000,
capacity: 128_000_000,
entry_size_limit: 4_000_000,
user_quota_period_seconds: 3600,
user_quota_bytes: 64_000_000,
},
}),
State::RunningIsolated => Some(Settings {
website: Website {
Expand Down Expand Up @@ -160,6 +167,13 @@ impl TestEnv {
server: String::new(),
port: 25,
},
image_cache: ImageCache {
max_request_timeout_ms: 1000,
capacity: 128_000_000,
entry_size_limit: 4_000_000,
user_quota_period_seconds: 3600,
user_quota_bytes: 64_000_000,
},
}),
}
}
Expand Down

0 comments on commit 88bd598

Please sign in to comment.