Skip to content
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

Fixed default fallback for storage engine for mongo versions > 6. #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pymongo_inmemory/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from os import path
import platform

from ._utils import mkdir_ifnot_exist
from ._utils import make_semver, mkdir_ifnot_exist
from .downloader._urls import best_url

DEFAULT_CONF = {}
Expand Down Expand Up @@ -127,7 +127,7 @@ def __init__(
)
self.archive_folder = mkdir_ifnot_exist(self.download_folder, self.url_hash)
self.extracted_folder = mkdir_ifnot_exist(self.extract_folder, self.url_hash)
self.storage_engine = conf("storage_engine", "ephemeralForTest")
self.storage_engine = self._build_storage_engine()

def __str__(self):
return (
Expand Down Expand Up @@ -165,3 +165,8 @@ def _build_download_url(self):

self.downloaded_version = downloaded_version
return dl_url

def _build_storage_engine(self):
major, minor, patch = make_semver(self.downloaded_version)
storage_engine_fallback = "wiredTiger" if major > 6 else "ephemeralForTest"
return conf("storage_engine", storage_engine_fallback)