Skip to content

Commit c31e77c

Browse files
committed
address review
1 parent 10d8355 commit c31e77c

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

.evergreen/run_perf_test.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
import subprocess
66
import sys
77
from datetime import datetime
8+
<<<<<<< Updated upstream
9+
=======
10+
from pathlib import Path
11+
>>>>>>> Stashed changes
812

913
LOGGER = logging.getLogger("test")
1014
logging.basicConfig(level=logging.INFO, format="%(levelname)-8s %(message)s")
@@ -48,8 +52,19 @@ def run_command(cmd: str | list[str], **kwargs) -> None:
4852
LOGGER.info("Running command '%s'... done.", cmd)
4953

5054

51-
os.chdir("tests/performance")
52-
5355
start_time = datetime.now()
5456
run_command(["python manage.py test"])
57+
ROOT = Path(__file__).absolute().parent.parent
58+
data_dir = ROOT / "specifications/source/benchmarking/odm-data"
59+
if not data_dir.exists():
60+
run_command("git clone --depth 1 https://github.com/mongodb/specifications.git")
61+
run_command("tar xf flat_models.tgz", cwd=data_dir)
62+
run_command("tar xf nested_models.tgz", cwd=data_dir)
63+
64+
os.chdir("tests/performance")
65+
start_time = datetime.now()
66+
run_command(
67+
["python manage.py test"],
68+
env=os.environ | {"TEST_PATH": str(data_dir), "OUTPUT_FILE": str(ROOT / "results.json")},
69+
)
5570
handle_perf(start_time)

tests/performance/perftest/settings.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
https://docs.djangoproject.com/en/5.2/ref/settings/
1111
"""
1212

13-
import os
1413
from pathlib import Path
1514

1615
import django_mongodb_backend
@@ -57,22 +56,13 @@
5756

5857
# Database
5958
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
60-
USER = os.environ.get("ATLAS_DEV_USER")
61-
PASSWORD = os.environ.get("ATLAS_DEV_PASSWORD")
62-
# DATABASES = {
63-
# "default": {
64-
# "ENGINE": "django_mongodb_backend",
65-
# "HOST": f"mongodb+srv://{USER}:{PASSWORD}@intpython736.oztdp.mongodb-dev.net/?retryWrites=true&w=majority&appName=INTPYTHON736",
66-
# "NAME": "benchmarking",
67-
# "PORT": 27017,
68-
# },
69-
# }
70-
71-
settings = django_mongodb_backend.parse_uri(
72-
"mongodb://localhost:27017/benchmarking",
73-
)
7459
DATABASES = {
75-
"default": settings,
60+
"default": {
61+
"ENGINE": "django_mongodb_backend",
62+
"HOST": "mongodb://localhost:27017/benchmarking",
63+
"NAME": "benchmarking",
64+
"PORT": 27017,
65+
},
7666
}
7767

7868
# Password validation

tests/performance/perftest/tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class SmallFlatDocTest(PerformanceTest):
168168

169169
def setUp(self):
170170
super().setUp()
171-
with open(Path(TEST_PATH) / Path("flat_models") / self.dataset) as data: # noqa: PTH123
171+
with open(Path(TEST_PATH) / Path("flat-models") / self.dataset) as data: # noqa: PTH123
172172
self.document = json_util.loads(data.read())
173173

174174
self.data_size = len(encode(self.document)) * NUM_DOCS
@@ -251,7 +251,7 @@ class LargeFlatDocTest(PerformanceTest):
251251

252252
def setUp(self):
253253
super().setUp()
254-
with open(Path(TEST_PATH) / Path("flat_models") / self.dataset) as data: # noqa: PTH123
254+
with open(Path(TEST_PATH) / Path("flat-models") / self.dataset) as data: # noqa: PTH123
255255
self.document = json_util.loads(data.read())
256256

257257
self.data_size = len(encode(self.document)) * NUM_DOCS
@@ -292,7 +292,7 @@ class LargeNestedDocTest(PerformanceTest):
292292

293293
def setUp(self):
294294
super().setUp()
295-
with open(Path(TEST_PATH) / Path("nested_models") / self.dataset) as data: # noqa: PTH123
295+
with open(Path(TEST_PATH) / Path("nested-models") / self.dataset) as data: # noqa: PTH123
296296
self.document = json_util.loads(data.read())
297297

298298
self.data_size = len(encode(self.document)) * NUM_DOCS

0 commit comments

Comments
 (0)