Provide four-hour idle baseline without application requests
This commit is contained in:
1 parent
e50cf0a011
commit
79bb6a11cd
4 files changed
+55
-8
No files matched your search
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the idle runner makes zero application requests, including preflight."""
|
||||
import csv,json,subprocess,tempfile,threading
|
||||
from pathlib import Path
|
||||
from http.server import BaseHTTPRequestHandler,ThreadingHTTPServer
|
||||
HERE=Path(__file__).parent
|
||||
class Application(BaseHTTPRequestHandler):
|
||||
requests=0
|
||||
def do_GET(self):
|
||||
type(self).requests+=1;self.send_response(500);self.end_headers()
|
||||
do_POST=do_GET
|
||||
def log_message(self,*args):pass
|
||||
server=ThreadingHTTPServer(('127.0.0.1',0),Application)
|
||||
threading.Thread(target=server.serve_forever,daemon=True).start()
|
||||
try:
|
||||
with tempfile.TemporaryDirectory(prefix='healthapp-idle-') as name:
|
||||
out=Path(name)/'run'
|
||||
result=subprocess.run(['python3',str(HERE/'run.py'),'idle','--host','127.0.0.1','--port',str(server.server_port),'--no-perfmon','--no-shelly','--warmup','1','--duration','3','--output',str(out)],capture_output=True,text=True)
|
||||
assert result.returncode==0,result.stdout+result.stderr
|
||||
data=json.loads((out/'run.json').read_text())
|
||||
assert Application.requests==0 and data['http_samples']==0 and data['users']==0
|
||||
assert data['measurement_end_ms']-data['measurement_start_ms']==3000
|
||||
assert data['measurement_start_ms']-data['warmup_start_ms']==1000
|
||||
with (out/'samples.csv').open() as f:assert all(not r['label'].startswith('HTTP ') for r in csv.DictReader(f))
|
||||
print('Idle baseline passed: no application calls or login, no CA/accounts needed, warmup excluded')
|
||||
finally:server.shutdown()
|
||||
Reference in new issue
Block a user