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

Return internal server error on failed hyperslab write #342

Merged
merged 1 commit into from
Apr 17, 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
3 changes: 2 additions & 1 deletion hsds/chunk_sn.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ async def _doHyperslabWrite(app,

if crawler_status not in (200, 201):
msg = f"crawler failed for page: {page_number} with status: {crawler_status}"
log.warn(msg)
log.error(msg)
raise HTTPInternalServerError()
else:
log.info("crawler write_chunk_hyperslab successful")

Expand Down
12 changes: 10 additions & 2 deletions tests/integ/vlen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,12 @@ def testPutVLenCompoundBinary(self):
# strings are showing up as bytes in the response
self.assertEqual(req_item, rsp_item.decode())

def testPutVLenUTF8(self):
def testPutVlenVlenError(self):
# Test PUT value for 1d dataset with vlen seq of vlen utf-8 strings
print("testPutVLenUTF8", self.base_domain)
# HSDS does not currently support this datatype, but previous versions
# of HSDS crashed when a request contained them. This test is to
# ensure that HSDS still responds successfully with an error.
print("testPutVlenVlenError", self.base_domain)

headers = helper.getRequestHeaders(domain=self.base_domain)
req = self.endpoint + "/"
Expand Down Expand Up @@ -758,6 +761,11 @@ def testPutVLenUTF8(self):
payload = {"value": data}
req = self.endpoint + "/datasets/" + dset_uuid + "/value"
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
self.assertTrue(rsp.status_code >= 400)

# Check that HSDS still responds to requests by getting the root
req = self.endpoint + "/"
rsp = self.session.get(req, headers=headers)
self.assertEqual(rsp.status_code, 200)


Expand Down
Loading