Skip to content

Conversation

bio-boris
Copy link

No description provided.

Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (576c841) to head (746dc31).
⚠️ Report is 6 commits behind head on add_authentication.

Additional details and impacted files
@@                   Coverage Diff                   @@
##           add_authentication       #99      +/-   ##
=======================================================
+ Coverage               99.85%   100.00%   +0.14%     
=======================================================
  Files                      21        21              
  Lines                     686       690       +4     
=======================================================
+ Hits                      685       690       +5     
+ Misses                      1         0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bio-boris bio-boris marked this pull request as ready for review October 21, 2025 17:00
@Copilot Copilot AI review requested due to automatic review settings October 21, 2025 17:00
@bio-boris bio-boris merged commit 688ace6 into add_authentication Oct 21, 2025
4 checks passed
@bio-boris bio-boris deleted the add_authentication_tests branch October 21, 2025 17:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds authentication support for Elasticsearch connections, enabling the application to work with authentication-enabled Elasticsearch instances. The changes implement Basic and Bearer authentication mechanisms and update the test infrastructure to support testing with authentication.

  • Adds authentication header support to Elasticsearch requests via get_elasticsearch_auth_header()
  • Updates docker-compose configuration to enable Elasticsearch security with default credentials
  • Implements comprehensive test coverage for authentication scenarios

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/test_auth_integration.py New integration tests verifying authentication requirements and credential validation
tests/unit/es_client/test_es_client.py Unit tests for authentication header handling in search requests
tests/unit/conftest.py Test configuration updated to set authentication environment variables
tests/helpers/unit_setup.py Service startup configuration with authentication credentials
tests/helpers/init_elasticsearch.py Updated to use configurable Elasticsearch URL from environment
src/search2_rpc/service.py Modified to add authentication headers to index listing requests
docker-compose.yaml Enabled Elasticsearch security with authentication credentials

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +2 to +10
import os
# Set environment variables BEFORE any other imports
# This ensures the config module picks up the auth credentials
os.environ['ELASTICSEARCH_URL'] = 'http://localhost:9200'
os.environ['ELASTICSEARCH_AUTH_USERNAME'] = 'elastic'
os.environ['ELASTICSEARCH_AUTH_PASSWORD'] = 'changeme'

import pytest # noqa: E402
from tests.helpers.unit_setup import ( # noqa: E402
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting environment variables directly in conftest.py creates hardcoded test configuration. Consider using pytest fixtures or a test configuration file to make these values configurable and avoid duplicating the same environment variable setup that also appears in unit_setup.py (lines 29-31).

Copilot uses AI. Check for mistakes.

Comment on lines +27 to +31
# Set environment variables BEFORE importing config module
# This ensures config picks up the auth credentials
os.environ['ELASTICSEARCH_URL'] = 'http://localhost:9200'
os.environ['ELASTICSEARCH_AUTH_USERNAME'] = 'elastic'
os.environ['ELASTICSEARCH_AUTH_PASSWORD'] = 'changeme'
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates the exact same environment variable configuration found in tests/unit/conftest.py (lines 5-7). Centralizing this configuration in one location would improve maintainability and prevent potential inconsistencies.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant