From a81aefd367e6986667859b251402f1c58adc8f45 Mon Sep 17 00:00:00 2001 From: Brian Brondel Date: Thu, 14 Nov 2024 14:40:15 -0300 Subject: [PATCH 1/2] Add unit test for insert to ccdexposure without day_obs and seq_num --- tests/test_pqserver.py | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/test_pqserver.py b/tests/test_pqserver.py index dcec1cef..362a49c7 100644 --- a/tests/test_pqserver.py +++ b/tests/test_pqserver.py @@ -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 From 077a9a5dc9e885cf7709ed499c315c7452c8da50 Mon Sep 17 00:00:00 2001 From: Brian Brondel Date: Thu, 14 Nov 2024 15:20:45 -0300 Subject: [PATCH 2/2] Use more recent OBS_LSST_VERSION --- Dockerfile.pytest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.pytest b/Dockerfile.pytest index 12f6ada1..20cd79ad 100644 --- a/Dockerfile.pytest +++ b/Dockerfile.pytest @@ -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