Skip to content

Commit

Permalink
Add test for POST dset with zero chunk extent (#236)
Browse files Browse the repository at this point in the history
Testing the issue reported in #192. This already passes,
so if this elicits the problem correctly, we can close that
issue without any further work.
  • Loading branch information
mattjala authored Jul 10, 2023
1 parent eb37d04 commit b229bfe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/integ/attr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class AttributeTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(AttributeTest, self).__init__(*args, **kwargs)
self.base_domain = helper.getTestDomainName(self.__class__.__name__)
print(self.base_domain)
self.endpoint = helper.getEndpoint()
helper.setupDomain(self.base_domain)

Expand Down
24 changes: 24 additions & 0 deletions tests/integ/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,30 @@ def testExtendibleDatasetChunkPartitioning(self):
self.assertTrue(chunk_size >= CHUNK_MIN)
self.assertTrue(chunk_size <= CHUNK_MAX)

def testDatasetEmptyChunkExtent(self):
# Attempting to create 0-extent chunks should respond with Bad Request
domain = self.base_domain + "/testDatasetEmptyChunkExtent.h5"
helper.setupDomain(domain)
print("testDatasetEmptyChunkExtent", domain)
headers = helper.getRequestHeaders(domain=domain)
req = helper.getEndpoint() + "/"

# create the dataset
req = self.endpoint + "/datasets"

dims = [1]
payload = {"type": "H5T_IEEE_F32LE",
"shape": dims}

payload["creationProperties"] = {
"layout": {"class": "H5D_CHUNKED", "dims": [0]}
}

req = self.endpoint + "/datasets"
rsp = self.session.post(req, data=json.dumps(payload), headers=headers)
# Should fail with Bad Request due to invalid layout value
self.assertEqual(rsp.status_code, 400) # create dataset


if __name__ == "__main__":
# setup test files
Expand Down

0 comments on commit b229bfe

Please sign in to comment.