Skip to content

Commit

Permalink
Merge pull request #254 from gulfofmaine/fix/actual_range_error
Browse files Browse the repository at this point in the history
Add test and tweak comparison for actual range error
  • Loading branch information
abkfenris authored Nov 3, 2020
2 parents c146fd1 + abc84cd commit 9fd0bce
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Changes:

Fixes:

- Add test and tweak comparison for actual range error.

## 0.1.12 - 11/3/2020

Changes:
Expand Down
2 changes: 1 addition & 1 deletion app/deployments/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def handle_500_variable_actual_range_error(timeseries_group, compare_text: str)
"""
if (
"Your query produced no matching results" in compare_text
and "is outside of the variable's actual_range" in compare_text
and "is outside of the variable's actual_range" in compare_text
):
logger.info(
f"{timeseries_group[0].dataset.name} with constraints {timeseries_group[0].constraints} had a constraint outside of normal range"
Expand Down
54 changes: 54 additions & 0 deletions app/deployments/tests/cassettes/500_no_rows_actual_range.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- python-requests/2.22.0
method: GET
uri: http://www.neracoos.org/erddap/tabledap/A01_waves_mstrain_all.csvp?time,maximum_wave_height_3&maximum_wave_height_3_qc=0&time%3E=1604331173.10337
response:
body:
string: !!binary |
H4sIAAAAAAAAA7WU22rbQBCGX2XqQGkhtnyoUyrLgkAK7UWhNLrplRmtRtbS1a6yO3LshkDeoW/Y
J+lISonpARpobgQ7M/vNP4dV8qxwig8NQcW1SZPuCwbtdj0iO5IzYZEmrNlQ+i7LPsIlI7cBltMp
fL/7Bu8tk7do4JL8jjy89d75JBouJIEPhqDDr0dMe45UCKO0msFN6SyPS6y1OcQZVq7G03Ov0ZwG
tGEcyOtypZxxPr6uNNMqR/Vl611ri/FgPlnOlxevz1Y9KOivFM/nzX51C9X8Seizs4G+eBr6q56e
u+LwGH5uBP07f0gruP+o9Raaf6M9EO6Rx1KPKh6mhXBz7BfDxGJNv1onRlsxVqS3FcczufpXobnz
BfnYOistSKJ+BdMkGha5a7As9ewxuyzRSeVBGQxhPeqEjCBKk0ZoaSarnUR5+hP1iRrnOYmae/8H
CgG3Q8hn13q4askfoPGuaBUVYB3UyKrSdgueQms4TOBFjXtdt/XmGne0GWreLDZXaj0FHcC1HHRB
4ErgimCHMoHc0POTxZtVAFTcotl4ecIUwxzYwfzlg6ALCsrrhrWzvahMCGEol6ySdkoLRBdaaC3t
G1IsJ+VsobsrkhBZ1NOObOfQDKV3NZStKbUxXRWdJE9SZuBJn/YPrasW6XmDSiIzVyuUfolF5PTD
ifof0Q9E3dMSmAQAAA==
headers:
Access-Control-Allow-Origin:
- '*'
Connection:
- close
Content-Encoding:
- gzip
Content-Language:
- en
Content-Length:
- '526'
Content-Type:
- text/html;charset=utf-8
Date:
- Tue, 03 Nov 2020 15:32:53 GMT
Last-Modified:
- Tue, 03 Nov 2020 15:32:53 GMT
Vary:
- Accept-Encoding,User-Agent
erddap-server:
- '1.82'
xdods-server:
- dods/3.7
status:
code: 500
message: Internal Server Error
version: 1
25 changes: 25 additions & 0 deletions app/deployments/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,28 @@ def test_500_no_rows(self):
ts.refresh_from_db()

assert ts.value is None

@my_vcr.use_cassette("500_no_rows_actual_range.yaml")
def test_500_actual_range(self):
a01 = Platform.objects.get(name="A01")
dataset = ErddapDataset.objects.create(
name="A01_waves_mstrain_all", server=self.erddap
)
ts = TimeSeries.objects.create(
platform=a01,
data_type=DataType.objects.get(standard_name="max_wave_height"),
variable="maximum_wave_height_3",
constraints={"maximum_wave_height_3_qc=": 0},
start_time="2019-05-29T19:06:07",
dataset=dataset,
)

ts.refresh_from_db()

assert ts.value is None

tasks.update_values_for_timeseries([ts])

ts.refresh_from_db()

assert ts.value is None

0 comments on commit 9fd0bce

Please sign in to comment.