Repository: qdrant/qdrant
File: tests/e2e_tests/test_data_compatibility.py (Python)

Code before:
import uuid

import pytest
import requests
from pathlib import Path

from e2e_tests.conftest import QdrantContainerConfig
from e2e_tests.client_utils import ClientUtils
from e2e_tests.utils import extract_archive


class TestStorageCompatibility:
    """Test storage and snapshot compatibility with defined previous Qdrant versions."""

    VERSIONS = [
        "v1.16.0",
        "v1.15.5",
        "v1.15.4",
        "v1.15.3",
        "v1.15.2",
        "v1.15.1",
        #"v1.15.0", # TODO when restoring Qdrant adds a missing payload_storage folder owned by `root` which messes up the cleanup
    ]

    EXPECTED_COLLECTIONS = [
        "test_collection_vector_memory",
        "test_collection_vector_on_disk",
        "test_collection_vector_on_disk_threshold",
        "test_collection_scalar_int8",
        "test_collection_product_x64",
        "test_collection_product_x32",
        "test_collection_product_x16",
        "test_collection_product_x8",
        "test_collection_binary",
        "test_collection_mmap_field_index",
        "test_collection_vector_datatype_u8",
        "test_collection_vector_datatype_f16"
    ]

    @staticmethod
    def _download_compatibility_data(version: str, storage_test_dir: Path):
        """Download compatibility data for a specific version."""
        # Use test-specific filename to avoid conflicts in parallel execution
        test_id = str(uuid.uuid4())[:8]
        compatibility_file = storage_test_dir / f"compatibility_{version}_{test_id}.tar"

        url = f"https://storage.googleapis.com/qdrant-backward-compatibility/compatibility-{version}.tar"

Review comment (bug):
```
Using existing Docker image qdrant/qdrant:e2e-tests
Downloading compatibility data for v1.15.0...
Extracted /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage/compatibility_v1.15.0_52880638.tar to /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage
Cleaned up archive: /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage/compatibility_v1.15.0_52880638.tar
Extracted /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage/storage.tar.bz2 to /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage
Cleaned up archive: /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage/storage.tar.bz2
Container already removed. OK.
F
==================================================
TEST FAILED - DUMPING CONTAINER LOGS
==================================================
==================================================
Warning: Failed to remove temp storage directory /home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]: [Errno 13] Permission denied: '/home/agourlay/Workspace/qdrant/tests/e2e_tests/test_storage_compatibility[v1.15.0]/storage/storage/collections/test_collection_product_x32/0/segments/930ece4a-cdb0-4fb5-86bf-5dfde0ab0024/payload_storage'
```

Code after:
import uuid

import pytest
import requests
from pathlib import Path

from e2e_tests.conftest import QdrantContainerConfig
from e2e_tests.client_utils import ClientUtils
from e2e_tests.utils import extract_archive


class TestStorageCompatibility:
    """Test storage and snapshot compatibility with defined previous Qdrant versions.

    These tests are grouped to run sequentially on the same worker using xdist_group marker.
    This prevents parallel downloads of large archives and disk saturation.
    """

    VERSIONS = [
        "v1.16.0",
        "v1.15.5",
        "v1.15.4",
        "v1.15.3",
        "v1.15.2",
        "v1.15.1",
        # "v1.15.0", # TODO when restoring Qdrant adds a missing payload_storage folder owned by `root` which messes up the cleanup
    ]

    EXPECTED_COLLECTIONS = [
        "test_collection_vector_memory",
        "test_collection_vector_on_disk",
        "test_collection_vector_on_disk_threshold",
        "test_collection_scalar_int8",
        "test_collection_product_x64",
        "test_collection_product_x32",
        "test_collection_product_x16",
        "test_collection_product_x8",
        "test_collection_binary",
        "test_collection_mmap_field_index",
        "test_collection_vector_datatype_u8",
        "test_collection_vector_datatype_f16"
    ]

    @staticmethod
    def _download_compatibility_data(version: str, storage_test_dir: Path):
        """Download compatibility data for a specific version.