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

DM-47125 Add unit test for ccdexposure insert with multi-column primary keys #55

Merged
merged 2 commits into from
Nov 14, 2024
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
2 changes: 1 addition & 1 deletion Dockerfile.pytest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG OBS_LSST_VERSION=w_2024_32
ARG OBS_LSST_VERSION=w_2024_46
FROM lsstsqre/centos:7-stack-lsst_distrib-${OBS_LSST_VERSION}
USER root

Expand Down
44 changes: 44 additions & 0 deletions tests/test_pqserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,50 @@ def test_schema_table(lsstcomcamsim, astropy_tables):
assert column in result.keys()


@pytest.mark.parametrize("lsstcomcamsim", ["cdb_latiss"], indirect=True)
def test_missing_primary_key(lsstcomcamsim):
client = lsstcomcamsim

response = client.post(
"/consdb/insert/latiss/exposure/obs/2024032100003",
json={
"values": {
"exposure_name": "AT_O_20240327_000002",
"controller": "O",
"day_obs": 20240327,
"seq_num": 2,
},
},
)
_assert_http_status(response, 200)
result = response.json()
assert result == {
"message": "Data inserted",
"table": "cdb_latiss.exposure",
"instrument": "latiss",
"obs_id": 2024032100003,
}

response = client.post(
"/consdb/insert/latiss/ccdexposure/obs/8675309",
json={
"values": {
"s_region": "testregion",
"exposure_id": 2024032100003,
"detector": 0,
},
},
)
_assert_http_status(response, 200)
result = response.json()
assert result == {
"message": "Data inserted",
"table": "cdb_latiss.ccdexposure",
"instrument": "latiss",
"obs_id": 8675309,
}


def test_validate_unit():
os.environ["POSTGRES_URL"] = "sqlite://"
from lsst.consdb import pqserver
Expand Down
Loading