Skip to content

Commit

Permalink
Add threaded get to multifile testing. (#91)
Browse files Browse the repository at this point in the history
This adds download of the threaded many file testing during post
deployment testing.

Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed May 30, 2019
1 parent 966ee4d commit fdc8757
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: autopep8
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.2.2
rev: v2.2.3
hooks:
- id: fix-encoding-pragma
- id: trailing-whitespace
Expand Down
28 changes: 26 additions & 2 deletions post_deployment_tests/deployment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_many_file_write(self):
num_worker_threads = 8
job_id_queue = Queue()

def worker():
def worker_put():
"""Thread worker to send the test data."""
work = job_id_queue.get()
while work:
Expand All @@ -254,7 +254,31 @@ def worker():
job_id_queue.task_done()

for i in range(num_worker_threads):
new_thread = Thread(target=worker)
new_thread = Thread(target=worker_put)
new_thread.daemon = True
new_thread.start()

for i in range(3000, int(os.getenv('MANY_FILES_TEST_COUNT', 1000))+3000):
job_id_queue.put(i)

for i in range(num_worker_threads):
job_id_queue.put(False)
job_id_queue.join()

def worker_get():
"""Thread worker to send the test data."""
work = job_id_queue.get()
while work:
resp = requests.get(
'{}/{}'.format(ARCHIVEURL, work))
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.content, unistr2binary('Writing content for first file'))
job_id_queue.task_done()
work = job_id_queue.get()
job_id_queue.task_done()

for i in range(num_worker_threads):
new_thread = Thread(target=worker_get)
new_thread.daemon = True
new_thread.start()

Expand Down

0 comments on commit fdc8757

Please sign in to comment.