Skip to content

Extend Storage tests to multiple backends #986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 53 commits into
base: main
Choose a base branch
from

Conversation

bpkroth
Copy link
Contributor

@bpkroth bpkroth commented Jun 2, 2025

Pull Request

Title

Extend Storage test to multiple backends.


Description

  • Turns the storage fixture into a parameterized one that allows testing all storage unit test methods via mem_storage (sqlite), postgres_storage, and mysql_storage whenever docker is available.
  • Associated bug fixes also addressed.

Type of Change

  • 🛠️ Bug fix
  • ✨ New feature
  • 🔄 Refactor
  • 🧪 Tests

Testing

  • All of the new tests.

Additional Notes (optional)


bpkroth and others added 30 commits May 28, 2025 09:13
@Copilot Copilot AI review requested due to automatic review settings June 2, 2025 21:17
@bpkroth bpkroth requested a review from a team as a code owner June 2, 2025 21:17
Copy link
Contributor

@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 extends the storage tests to support multiple backend types while refactoring and updating various SSH and storage-related fixtures, configuration files, and schema migration support. Key changes include parameterizing the storage fixture (covering mem_storage, postgres_storage, and mysql_storage), refactoring SSH fixture dependencies (e.g. replacing ssh_test_server_hostname with docker_hostname), and updating the SQL schema definitions/migrations together with enhancements to storage experiment handling.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
mlos_bench/tests/services/remote/ssh/fixtures.py Refactored fixture dependency by replacing use of ssh_test_server_hostname with docker_hostname and removing an unused import.
mlos_bench/tests/services/remote/ssh/conftest.py Removed redundant fixture alias for ssh_test_server_hostname.
mlos_bench/tests/services/remote/ssh/init.py Cleaned up unused imports and inline documentation in the SSH module.
mlos_bench/tests/environments/local/*.py Updated timestamp formatting in telemetry tests and removed rounding of microseconds.
mlos_bench/tests/conftest.py & mlos_bench/tests/init.py Added new docker_hostname fixture and redefined wait_docker_service_socket for improved cross-platform compatibility.
mlos_bench/storage/sql/* Introduced a new _reset_schema testing helper, updated column definitions to use dynamic length values, and refined experiment property handling for git configuration.
mlos_bench/storage/sql/alembic/* Added migration scripts and updated the env configuration to support fractional seconds in MySQL.
mlos_bench/storage/base_storage.py Modified the constructor to handle cases when root_env_config is None and required git parameters are provided, and added new properties for relative and absolute configuration paths.
mlos_bench/config/storage/* Updated storage configuration files for consistency with the new database naming.
Comments suppressed due to low confidence (4)

mlos_bench/tests/init.py:15

  • There appear to be multiple definitions of wait_docker_service_socket across different modules. Consider refactoring this helper into a common utility to avoid duplication and ensure consistency.
def wait_docker_service_socket(docker_services: DockerServices, hostname: str, port: int) -> None:

mlos_bench/tests/environments/local/local_env_telemetry_test.py:18

  • The removal of microsecond rounding may introduce precision issues in tests that expect whole-second timestamps. Verify that this change does not affect downstream comparisons or expected outputs.
ts1 -= timedelta(microseconds=ts1.microsecond)  # Round to a second

mlos_bench/storage/base_storage.py:202

  • Changing the constructor behavior to require git_repo, git_commit, and rel_root_env_config when root_env_config is None is a breaking change. Ensure that callers or tests have been updated to pass these parameters accordingly.
if root_env_config is None:

mlos_bench/tests/conftest.py:45

  • The docker_hostname fixture now returns "127.0.0.1" instead of "localhost" on non-Windows platforms. Verify that this change is intentional and consistent with how hostnames are resolved in other parts of the test suite.
return "127.0.0.1"  # "localhost"

@bpkroth bpkroth added WIP Work in progress - do not merge yet tests Add or fix unit tests labels Jun 2, 2025
@bpkroth bpkroth marked this pull request as draft June 5, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Add or fix unit tests WIP Work in progress - do not merge yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant