Skip to content

🧪 Add e2e MySQL querying test with SASL plain authentication using testcontainers #1394

Open
@coderabbitai

Description

@coderabbitai

Problem Description

This PR (#1386) adds libxcrypt-compat to resolve MySQL SASL2 plugin library dependencies requiring libcrypt.so.1 in Python 3.12 images. To ensure this fix works properly and prevent regressions, we need a comprehensive end-to-end test that validates MySQL connectivity with SASL plain authentication.

Currently, there's a partially implemented "vibe-coded" test that attempts MySQL querying with SASL plain using testcontainers, but it needs adjustments and proper integration into the test suite.

Detailed Implementation Approach

Test Structure

  • Location: Add to existing test notebooks in affected image directories (e.g., jupyter/datascience/ubi9-python-3.12/test/)
  • Framework: Use testcontainers-python for MySQL container orchestration
  • Authentication: Focus on SASL plain authentication to verify the libcrypt.so.1 dependency fix

Implementation Steps

  1. Container Setup
    Use testcontainers-python MySqlContainer to orchestrate MySQL instance with SASL configuration

  2. SASL Configuration
    Configure SASL plain authentication with proper connection parameters

  3. Connection Testing
    Test MySQL connectivity using mysql.connector with SASL plain authentication

  4. Library Dependency Validation
    Verify libcrypt.so.1 is available for MySQL SASL2 plugins using ldd command

Integration Points

  1. Test Environment Setup

    • Add testcontainers-python to requirements.txt
    • Configure Docker socket access in test environment
    • Set up proper test isolation and cleanup
  2. CI/CD Integration

    • Ensure Docker daemon is available in test environment
    • Add container cleanup in test teardown
    • Configure timeout handling for container startup
  3. Cross-Platform Testing

    • Test on both x86_64 and ARM64 architectures
    • Validate container compatibility across different platforms
    • Handle architecture-specific MySQL image variations

Acceptance Criteria

Primary Goals

  • Test successfully connects to MySQL using SASL plain authentication
  • Verify libcrypt.so.1 dependency is resolved (no "not found" errors)
  • Execute basic CRUD operations through the authenticated connection
  • Test runs reliably in CI/CD environment

Implementation Requirements

  • Add testcontainers-python dependency to affected image requirements
  • Create comprehensive test covering connection, authentication, and data operations
  • Implement proper error handling and meaningful failure messages
  • Add container lifecycle management (startup, cleanup)

Coverage Validation

  • Test covers all Python 3.12 images affected by this PR:
    • jupyter/datascience/ubi9-python-3.12
    • jupyter/pytorch/ubi9-python-3.12 (CUDA)
    • jupyter/tensorflow/ubi9-python-3.12 (CUDA)
    • jupyter/trustyai/ubi9-python-3.12
    • jupyter/rocm/pytorch/ubi9-python-3.12
    • runtimes/datascience/ubi9-python-3.12
    • runtimes/pytorch/ubi9-python-3.12 (CUDA)
    • runtimes/tensorflow/ubi9-python-3.12 (CUDA)
    • runtimes/rocm-pytorch/ubi9-python-3.12

Testing Approach

  • Unit tests for individual components
  • Integration tests for full e2e workflow
  • Performance validation for container startup times
  • Error scenario testing (connection failures, authentication errors)

Implementation Notes

  1. Container Resource Management: Implement proper resource limits and cleanup to prevent test environment resource exhaustion
  2. Test Isolation: Ensure tests don't interfere with each other through proper container naming and port management
  3. Error Debugging: Include detailed logging and error reporting for easier troubleshooting
  4. Documentation: Add clear documentation for running tests locally and in CI/CD

Context and References

This test will provide confidence that the libxcrypt-compat fix properly resolves MySQL SASL authentication issues and prevent future regressions in Python 3.12 images.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions