-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from lsst/tickets/SP-1612
SP-1612 Add tests to ensure the Scheduler Snapshot Dashboard is working properly in LFA mode
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ pre-commit | |
boto3 | ||
botocore | ||
playwright | ||
pytest-asyncio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
from datetime import datetime | ||
|
||
import pytest | ||
|
||
# Objects to test instances against. | ||
from rubin_scheduler.scheduler.features.conditions import Conditions | ||
from rubin_scheduler.scheduler.schedulers.core_scheduler import CoreScheduler | ||
|
||
from schedview.app.scheduler_dashboard.scheduler_dashboard_app import LFASchedulerSnapshotDashboard | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_scheduler_list(): | ||
scheduler = LFASchedulerSnapshotDashboard() | ||
scheduler.telescope = None | ||
await scheduler.get_scheduler_list() | ||
# No snapshots should be retreived if it isn't an LFA environment | ||
# the dropdown has one empty option | ||
assert len(scheduler.param.scheduler_fname.objects) >= 1 | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_scheduler_list_in_USDF(): | ||
scheduler = LFASchedulerSnapshotDashboard() | ||
|
||
scheduler.telescope = None | ||
scheduler.pickles_date = datetime(2024, 10, 1, 21, 26, 23) | ||
await scheduler.get_scheduler_list() | ||
# make sure it's a LFA environment by checking | ||
# the env variables needed for LFA mode are set | ||
if os.environ.get("AWS_SHARED_CREDENTIALS_FILE") and os.environ.get("S3_ENDPOINT_URL"): | ||
# at least one snapshot file should be retreived | ||
# the dropdown should have one empty option + | ||
# at least one snapshot | ||
assert len(scheduler.param.scheduler_fname.objects) >= 2 | ||
scheduler.scheduler_fname = scheduler.param["scheduler_fname"].objects[1] | ||
scheduler.read_scheduler() | ||
assert isinstance(scheduler._scheduler, CoreScheduler) | ||
assert isinstance(scheduler._conditions, Conditions) | ||
else: | ||
# pass the test if it isn't an LFA environment | ||
pass |