code: def test_queue_delete_ttl_index(mongo_host: str) -> None:
      with MongoResource(
          database="test_queue_delete_ttl_index",
          host=mongo_host,
          mongoengine_alias="queue",
      ):
          JobDocument(
              type="test",
              dataset="test",
              revision="test",
              unicity_id="test",
              namespace="test",
              created_at=get_datetime(),
              difficulty=50,
          ).save()
          db = get_db(QUEUE_MONGOENGINE_ALIAS)
          assert (
              len(
                  get_index_names(
                      db[QUEUE_COLLECTION_JOBS].index_information(),
                      "finished_at",
                  )
              )
              == 1
          )  # Ensure the TTL index exists
  
          migration = MigrationQueueDeleteTTLIndex(
              version="20230428145000",
              description="remove ttl index on field 'finished_at'",
              field_name="finished_at",
          )
          migration.up()
  
          assert (
              len(
                  get_index_names(
                      db[QUEUE_COLLECTION_JOBS].index_information(),
                      "finished_at",
                  )
              )
              == 0
          )  # Ensure the TTL index does not exist anymore
  
          db[QUEUE_COLLECTION_JOBS].drop()
  
file_path: datasets-server/jobs/mongodb_migration/tests/test_deletion_migrations.py
imports: import pytest
  from libcommon.constants import CACHE_COLLECTION_RESPONSES, CACHE_METRICS_COLLECTION, CACHE_MONGOENGINE_ALIAS, METRICS_MONGOENGINE_ALIAS, QUEUE_COLLECTION_JOBS, QUEUE_METRICS_COLLECTION, QUEUE_MONGOENGINE_ALIAS
  from libcommon.queue import JobDocument
  from libcommon.resources import MongoResource
  from libcommon.utils import Status, get_datetime
  from mongoengine.connection import get_db
  from pytest import raises
  from mongodb_migration.deletion_migrations import CacheDeletionMigration, MetricsDeletionMigration, MigrationDeleteJobsByStatus, MigrationQueueDeleteTTLIndex, MigrationRemoveFieldFromCache, MigrationRemoveFieldFromJob, QueueDeletionMigration, get_index_names
  from mongodb_migration.migration import IrreversibleMigrationError
label_desc: Use image node_id 4 for calling a global function with example usage: test_queue_delete_ttl_index(mongo_host) without return types