hubcio commented on code in PR #2452:
URL: https://github.com/apache/iggy/pull/2452#discussion_r2696042594
##########
core/server/src/configs/validators.rs:
##########
@@ -255,6 +262,32 @@ impl Validatable<ConfigurationError> for
PersonalAccessTokenConfig {
}
}
+impl Validatable<ConfigurationError> for LoggingConfig {
Review Comment:
you should check if `rotation_check_interval.as_secs()` is < 1
##########
core/integration/tests/server/scenarios/log_rotation_scenario.rs:
##########
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use iggy::prelude::*;
+use iggy_common::{
+ CompressionAlgorithm, Identifier, IggyByteSize, IggyDuration, IggyExpiry,
MaxTopicSize,
+};
+use integration::test_server::{ClientFactory, login_root};
+use std::path::Path;
+use std::time::Duration;
+use tokio::fs;
+use tokio::time::{sleep, timeout};
+
+pub const MAX_SINGLE_LOG_SIZE: IggyByteSize = IggyByteSize::new(2 * 1000 *
1000);
+pub const MAX_TOTAL_LOG_SIZE: IggyByteSize = IggyByteSize::new(10 * 1000 *
1000);
+pub const LOG_ROTATION_CHECK_INTERVAL: IggyDuration = IggyDuration::ONE_SECOND;
+const OPERATION_TIMEOUT_SECS: u64 = 10;
+const OPERATION_LOOP_COUNT: usize = 3000;
+const OPERATION_BATCH_SIZE: usize = 500;
+const IGGY_LOG_BASE_NAME: &str = "iggy-server.log";
+
+pub async fn run(client_factory: &dyn ClientFactory, log_dir: &str) {
+ let log_path = Path::new(log_dir);
+ assert!(
+ log_path.exists() && log_path.is_dir(),
+ "Log directory does not exist or is not a valid directory: {log_dir}"
+ );
+ println!("Log directory verified: {log_dir}");
+
+ let client = match init_valid_client(client_factory).await {
+ Ok(c) => c,
+ Err(e) => {
+ panic!("Client initialization failed, cannot continue generating
logs: {e}");
+ }
+ };
+
+ if let Err(e) = generate_enough_logs(&client).await {
+ eprintln!("Partial errors occurred during log generation: {e}");
+ } else {
+ sleep(LOG_ROTATION_CHECK_INTERVAL.get_duration()).await;
+ let rotation_result = validate_log_rotation_rules(log_path).await;
+ match rotation_result {
+ Ok(()) => println!("Succeeded Verified Log Rotation"),
+ Err(e) => {
+ eprintln!("Failed: {e}");
Review Comment:
you should panic here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]