Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:

strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
mongodb-version: ['4.2', '4.4', '5.0', '6.0']
python-version: ['3.10', '3.11', '3.12', '3.13']
mongodb-version: ['5.0', '6.0', '7.0', '8.0']
dservercore-version: [ main ]
dserver-search-plugin-mongo-version: [ main ]

Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ CHANGELOG
This project uses `semantic versioning <http://semver.org/>`_.
This change log uses principles from `keep a changelog <http://keepachangelog.com/>`_.

[Unreleased]
------------

Changed
^^^^^^^

- Dropped support for Python 3.7–3.9; minimum is now Python 3.10
- Updated CI Python matrix to 3.10–3.13; updated MongoDB matrix to 5.0–8.0

Fixed
^^^^^

- Test fixtures: hardcoded MongoDB URI replaced by ``MONGO_URI`` environment variable (default: ``mongodb://localhost:27017/``)
- Test fixtures: added ``client.close()`` after ``drop_database()`` in teardown to prevent connection pool exhaustion
- Test fixtures: removed stale ``FLASK_ENV`` key from app config (removed in Flask 3.0)
- Config route test: URI assertion now reads from ``MONGO_URI`` environment variable

[0.4.2]
-------

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ authors = [
{name = "Johannes L. Hörmann", email = "johannes.laurin@gmail.com"},
]
dynamic = ["version"]
requires-python = ">=3.10"
dependencies = [
"pymongo",
"dtoolcore>=3.18.0",
Expand Down
11 changes: 7 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Reusable fixtures"""

import os
import random
import string

import pytest

JWT_PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8LrEp0Q6l1WPsY32uOPqEjaisQScnzO/XvlhQTzj5w+hFObjiNgIaHRceYh3hZZwsRsHIkCxOY0JgUPeFP9IVXso0VptIjCPRF5yrV/+dF1rtl4eyYj/XOBvSDzbQQwqdjhHffw0TXW0f/yjGGJCYM+tw/9dmj9VilAMNTx1H76uPKUo4M3vLBQLo2tj7z1jlh4Jlw5hKBRcWQWbpWP95p71Db6gSpqReDYbx57BW19APMVketUYsXfXTztM/HWz35J9HDya3ID0Dl+pE22Wo8SZo2+ULKu/4OYVcD8DjF15WwXrcuFDypX132j+LUWOVWxCs5hdMybSDwF3ZhVBH ec2-user@ip-172-31-41-191.eu-west-1.compute.internal" # NOQA

MONGO_URI = os.environ.get("MONGO_URI", "mongodb://localhost:27017/")


def random_string(
Expand Down Expand Up @@ -41,12 +43,11 @@ def tmp_app_with_users(request):
"OPENAPI_VERSION": '3.0.2',
"CONFIG_SECRETS_TO_OBFUSCATE": [],
"SECRET_KEY": "secret",
"FLASK_ENV": "development",
"SQLALCHEMY_DATABASE_URI": "sqlite:///:memory:",
"RETRIEVE_MONGO_URI": "mongodb://localhost:27017/",
"RETRIEVE_MONGO_URI": MONGO_URI,
"RETRIEVE_MONGO_DB": tmp_mongo_db_name,
"RETRIEVE_MONGO_COLLECTION": "datasets",
"SEARCH_MONGO_URI": "mongodb://localhost:27017/",
"SEARCH_MONGO_URI": MONGO_URI,
"SEARCH_MONGO_DB": tmp_mongo_db_name,
"SEARCH_MONGO_COLLECTION": "datasets",
"SQLALCHEMY_TRACK_MODIFICATIONS": False,
Expand Down Expand Up @@ -84,7 +85,9 @@ def tmp_app_with_users(request):
@request.addfinalizer
def teardown():
current_app.retrieve.client.drop_database(tmp_mongo_db_name)
current_app.retrieve.client.close()
current_app.search.client.drop_database(tmp_mongo_db_name)
current_app.search.client.close()
sql_db.session.remove()

return app.test_client()
return app.test_client()
3 changes: 2 additions & 1 deletion tests/test_config_route.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test the /config blueprint route."""

import json
import os
import dserver_retrieve_plugin_mongo

from .utils import compare_nested
Expand All @@ -17,7 +18,7 @@ def test_config_info_route(tmp_app_with_users, snowwhite_token): # NOQA

expected_content = {
'retrieve_mongo_collection': 'datasets',
'retrieve_mongo_uri': 'mongodb://localhost:27017/',
'retrieve_mongo_uri': os.environ.get("MONGO_URI", "mongodb://localhost:27017/"),
}

response = json.loads(r.data.decode("utf-8"))
Expand Down
5 changes: 3 additions & 2 deletions tests/test_utils_retrieve_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
# This tested in this module.
from dserver_retrieve_plugin_mongo.utils_retrieve import MongoRetrieve


MONGO_URI = "mongodb://localhost:27017"
import os
MONGO_URI = os.environ.get("MONGO_URI", "mongodb://localhost:27017/")


def random_string(
Expand All @@ -40,6 +40,7 @@ def tmp_mongo_db(request):
@request.addfinalizer
def teardown():
client.drop_database(tmp_mongo_db_name)
client.close()

return tmp_mongo_db_name

Expand Down
Loading