Skip to content

Commit

Permalink
moved env tests to env/tests/
Browse files Browse the repository at this point in the history
  • Loading branch information
wangpatrick57 committed Dec 26, 2024
1 parent 910c218 commit 723a72a
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
# Integration tests do require external systems to be running (most commonly a database instance).
# Unlike end-to-end tests though, they test a specific module in a detailed manner, much like a unit test does.
env:
# We set `INTENDED_DBDATA_HARDWARE` so that it's seen when `integtest_pg_conn.py` executes `./env/set_up_gymlib_integtest_workspace.sh`.
# We set `INTENDED_DBDATA_HARDWARE` so that it's seen when `integtest_pg_conn.py` executes `set_up_gymlib_integtest_workspace.sh`.
INTENDED_DBDATA_HARDWARE: ssd
run: |
. "$HOME/.cargo/env"
Expand Down
Empty file added env/tests/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import psycopg

from env.integtest_util import GymlibIntegtestManager
from env.pg_conn import PostgresConn
from env.tests.integtest_util import GymlibIntegtestManager
from util.pg import (
DEFAULT_POSTGRES_PORT,
get_is_postgres_running,
Expand Down
2 changes: 1 addition & 1 deletion env/integtest_replay.py → env/tests/integtest_replay.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest

from benchmark.tpch.constants import DEFAULT_TPCH_SEED
from env.integtest_util import GymlibIntegtestManager
from env.replay import replay
from env.tests.integtest_util import GymlibIntegtestManager
from env.tuning_artifacts import (
DBMSConfigDelta,
IndexesDelta,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from env.integtest_util import GymlibIntegtestManager
from env.tests.integtest_util import GymlibIntegtestManager
from env.tuning_artifacts import (
DBMSConfigDelta,
IndexesDelta,
Expand Down
8 changes: 5 additions & 3 deletions env/integtest_util.py → env/tests/integtest_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ class GymlibIntegtestManager:
inside a class makes it clear that they are related to the gymlib integration tests.
"""

# These are the values used by set_up_gymlib_integtest_workspace.sh.
# These constants are also used by set_up_gymlib_integtest_workspace.sh.
BENCHMARK = "tpch"
SCALE_FACTOR = 0.01
# TODO: make DBGYM_CONFIG_FPATH an envvar.
DBGYM_CONFIG_FPATH = Path("env/tests/gymlib_integtest_dbgym_config.yaml")

DBGYM_CONFIG_FPATH = Path("env/gymlib_integtest_dbgym_config.yaml")
# This is set at most once by set_up_workspace().
DBGYM_WORKSPACE: Optional[DBGymWorkspace] = None

@staticmethod
Expand All @@ -43,7 +45,7 @@ def set_up_workspace() -> None:
# This if statement prevents us from setting up the workspace twice, which saves time.
if not workspace_path.exists():
subprocess.run(
["./env/set_up_gymlib_integtest_workspace.sh"],
["./env/tests/set_up_gymlib_integtest_workspace.sh"],
env={
"BENCHMARK": GymlibIntegtestManager.BENCHMARK,
"SCALE_FACTOR": str(GymlibIntegtestManager.SCALE_FACTOR),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from benchmark.tpch.constants import DEFAULT_TPCH_SEED, NUM_TPCH_QUERIES
from env.integtest_util import GymlibIntegtestManager
from env.tests.integtest_util import GymlibIntegtestManager
from env.workload import Workload
from util.workspace import (
fully_resolve_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -euo pipefail

# INTENDED_DBDATA_HARDWARE can be set elsewhere (e.g. by tests_ci.yaml) but we use hdd by default.
INTENDED_DBDATA_HARDWARE="${INTENDED_DBDATA_HARDWARE:-hdd}"
export DBGYM_CONFIG_PATH=env/gymlib_integtest_dbgym_config.yaml # Note that this envvar needs to be exported.
export DBGYM_CONFIG_PATH=env/tests/gymlib_integtest_dbgym_config.yaml # Note that this envvar needs to be exported.
WORKSPACE_PATH=$(grep 'dbgym_workspace_path:' $DBGYM_CONFIG_PATH | sed 's/dbgym_workspace_path: //')

python3 task.py benchmark $BENCHMARK data $SCALE_FACTOR
Expand Down

0 comments on commit 723a72a

Please sign in to comment.