Commit 6b31b789 authored by Ciarán Ó Rourke's avatar Ciarán Ó Rourke
Browse files

Stress tests for the server request handlers

Change log:
* remove empty get file
* add function for PUT, GETMD GET with random key and get_file_name
* add stress test involving multiple parallel requests
parent eb025076
Pipeline #1264 passed with stages
in 5 minutes and 45 seconds
......@@ -3,6 +3,7 @@ import unittest
import subprocess
import signal
import os
from multiprocessing import Process
import utils.s3_client as s3_client
import utils.compare as compare
......@@ -23,6 +24,7 @@ class Server_test_case(unittest.TestCase):
@classmethod
def tearDownClass(cls):
os.remove(cls.get_file_name)
os.remove(cls.get_empty_file_name)
cls.server.terminate()
# kill the fiphoboserver process
......@@ -98,3 +100,40 @@ class Server_test_case(unittest.TestCase):
self.assertTrue(
put_meta_data == get_meta_data
)
def client_process(self):
key = random_string.random_string('key_', 12)
get_file_name = random_string.random_string('data/', 11)
self.client.put(
self.put_file_name,
self.bucket_name,
key
)
self.client.get(
get_file_name,
self.bucket_name,
key
)
get_meta_data = self.client.get_md(
self.bucket_name,
key
)
self.assertTrue(
compare.files_are_equal(self.put_file_name, get_file_name)
)
# clean up files
os.remove(get_file_name)
return 0
def test_stress(self):
processes = []
for i in range(10):
process = Process(target=self.client_process())
processes.append(process)
process.start()
for process in processes:
process.join()
Supports Markdown
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