;### Changed
Some checks failed
Deploy quoter Microservice on push / deploy (push) Failing after 39m16s

- 🔑 **JWT_SECRET → JWT_SECRET_KEY**: Используется `JWT_SECRET_KEY` для совместимости с `@core`, `@inbox`, `@presence`
  - Fallback на `JWT_SECRET` для обратной совместимости
  - Обновлена документация: README.md, configuration.md
  - **BREAKING**: Требует установки `JWT_SECRET_KEY` в production (или использование legacy `JWT_SECRET`)

### Fixed (Tests & Code Quality)
- 🧪 **Удален мертвый код**: Removed unused mock functions and structs from tests
- 🔧 **Исправлены async тесты**: Changed `#[test]` → `#[tokio::test]` для async функций
- 🧹 **Чистые warnings**: Все тесты компилируются без warnings
- 📝 **Префиксы unused полей**: `_field` вместо `#[allow(dead_code)]`
This commit is contained in:
2025-09-30 21:46:47 +03:00
parent a78ad938a5
commit 5baba346e0
12 changed files with 71 additions and 170 deletions

View File

@@ -12,52 +12,24 @@ struct MockRedisConnection;
#[derive(Clone)]
struct MockS3Client;
/// Мок для AppState
/// Мок для AppState - только используемые методы
#[derive(Clone)]
struct MockAppState {
redis: MockRedisConnection,
storj_client: MockS3Client,
aws_client: MockS3Client,
bucket: String,
_redis: MockRedisConnection,
_storj_client: MockS3Client,
_aws_client: MockS3Client,
_bucket: String,
}
impl MockAppState {
fn new() -> Self {
Self {
redis: MockRedisConnection,
storj_client: MockS3Client,
aws_client: MockS3Client,
bucket: "test-bucket".to_string(),
_redis: MockRedisConnection,
_storj_client: MockS3Client,
_aws_client: MockS3Client,
_bucket: "test-bucket".to_string(),
}
}
async fn get_or_create_quota(&self, _user_id: &str) -> Result<u64, actix_web::Error> {
Ok(1024 * 1024) // 1MB
}
async fn increase_user_quota(
&self,
_user_id: &str,
_additional_bytes: u64,
) -> Result<u64, actix_web::Error> {
Ok(2 * 1024 * 1024) // 2MB
}
async fn set_user_quota(&self, _user_id: &str, _bytes: u64) -> Result<u64, actix_web::Error> {
Ok(3 * 1024 * 1024) // 3MB
}
async fn get_path(&self, _filename: &str) -> Result<Option<String>, actix_web::Error> {
Ok(Some("test/path/file.jpg".to_string()))
}
async fn set_path(&self, _filename: &str, _filepath: &str) {
// Mock implementation
}
async fn cache_filelist(&self) {
// Mock implementation
}
}
/// Тест для get_quota_handler
@@ -289,7 +261,7 @@ async fn test_cors_headers() {
assert!(resp.status().is_success());
// Проверяем наличие CORS headers
let headers = resp.headers();
let _headers = resp.headers();
// В тестовой среде CORS headers могут не добавляться автоматически
// Проверяем только успешность запроса
assert!(resp.status().is_success());