generated from jric11/baseProject
21 lines
986 B
Python
21 lines
986 B
Python
|
|
import os,subprocess,time
|
||
|
|
from application_harness import Application,PHP,ROOT
|
||
|
|
app=Application()
|
||
|
|
workers=[]
|
||
|
|
try:
|
||
|
|
ids=app.fixture('tenantSeed');env=app.env.copy();env['HCR_CLUB_EXPORT_HOURLY']='5';start=str(time.time()+2)
|
||
|
|
for n in range(12):
|
||
|
|
workers.append(subprocess.Popen(PHP+['tests/resource_worker.php',str(ids['admina' if n%2 else 'admina2']),str(ids['clubA']),start],cwd=ROOT,env=env,stdout=subprocess.PIPE,stderr=subprocess.PIPE,text=True))
|
||
|
|
outputs=[]
|
||
|
|
for worker in workers:
|
||
|
|
out,err=worker.communicate(timeout=20)
|
||
|
|
if worker.returncode:raise RuntimeError(err+out)
|
||
|
|
outputs.append(out)
|
||
|
|
assert outputs.count('allowed')==5 and outputs.count('limited')==7,outputs
|
||
|
|
print('PASS: Twelve simultaneous requests from two administrators share exactly five export slots')
|
||
|
|
print('1 resource concurrency scenario passed.')
|
||
|
|
finally:
|
||
|
|
for worker in workers:
|
||
|
|
if worker.poll() is None:worker.kill();worker.wait()
|
||
|
|
app.close()
|