Refactor Docker and configuration files for improved structure and functionality

- Updated `.dockerignore` to include additional development and temporary files, enhancing build efficiency.
- Modified `.gitignore` to remove unnecessary entries and streamline ignored files.
- Enhanced `docker-compose.yml` with health checks, resource limits, and improved environment variable handling for better service management.
- Refactored `Dockerfile.bot` to utilize a multi-stage build for optimized image size and security.
- Improved `Makefile` with new commands for deployment, migration, and backup, along with enhanced help documentation.
- Updated `requirements.txt` to include new dependencies for environment variable management.
- Refactored metrics handling in the bot to ensure proper initialization and collection.
This commit is contained in:
2025-08-29 23:15:06 +03:00
parent f097d69dd4
commit 8f338196b7
27 changed files with 1499 additions and 370 deletions

View File

@@ -94,7 +94,8 @@ class TestPrivateHandlers:
assert handlers.sticker_service is not None
assert handlers.router is not None
def test_handle_emoji_message(self, mock_db, mock_settings, mock_message, mock_state):
@pytest.mark.asyncio
async def test_handle_emoji_message(self, mock_db, mock_settings, mock_message, mock_state):
"""Test emoji message handler"""
handlers = create_private_handlers(mock_db, mock_settings)
@@ -103,7 +104,7 @@ class TestPrivateHandlers:
m.setattr('helper_bot.handlers.private.private_handlers.check_user_emoji', lambda x: "😊")
# Test the handler
handlers.handle_emoji_message(mock_message, mock_state)
await handlers.handle_emoji_message(mock_message, mock_state)
# Verify state was set
mock_state.set_state.assert_called_once_with(FSM_STATES["START"])
@@ -111,7 +112,8 @@ class TestPrivateHandlers:
# Verify message was logged
mock_message.forward.assert_called_once_with(chat_id=mock_settings.group_for_logs)
def test_handle_start_message(self, mock_db, mock_settings, mock_message, mock_state):
@pytest.mark.asyncio
async def test_handle_start_message(self, mock_db, mock_settings, mock_message, mock_state):
"""Test start message handler"""
handlers = create_private_handlers(mock_db, mock_settings)
@@ -122,7 +124,7 @@ class TestPrivateHandlers:
m.setattr('helper_bot.handlers.private.private_handlers.get_reply_keyboard', lambda x, y: Mock())
# Test the handler
handlers.handle_start_message(mock_message, mock_state)
await handlers.handle_start_message(mock_message, mock_state)
# Verify state was set
mock_state.set_state.assert_called_once_with(FSM_STATES["START"])