Skip to content

Commit

Permalink
Return error code on failed hyperslab write
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Apr 16, 2024
1 parent ccd63c2 commit f58d933
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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

0 comments on commit f58d933

Please sign in to comment.