Commit 66df7071 authored by Łukasz Nowak's avatar Łukasz Nowak

Check DirectoryNotFound in case of too many keys.

parent a4084ddd
......@@ -264,6 +264,23 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
self.assertEqual(error.code, httplib.NOT_FOUND)
def test_select_DirectoryNotFound_too_many_for_key(self):
nc = slapos.libnetworkcache.NetworkcacheClient(self.shacache, self.shadir)
key = 'somekey' + str(random.random())
urlmd5 = str(random.random())
file_name='my file'
test_data = tempfile.TemporaryFile()
test_string = str(random.random())
test_data.write(self.test_string)
test_data.seek(0)
nc.upload(self.test_data, key, urlmd5=urlmd5, file_name=file_name)
nc.upload(test_data, key, urlmd5=urlmd5, file_name=file_name)
try:
nc.select(key)
except slapos.libnetworkcache.DirectoryNotFound, msg:
self.assertTrue(
str(msg).startswith("Too many entries for a given key %r"% key))
def _run_nc_POST200(tree, host, port):
server_address = (host, port)
httpd = Server(tree, server_address, NCHandlerPOST200)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment