ЛР 2 — БВТ2303 — Крайкин — на 5 #3

Closed
Qu1ck_1337 wants to merge 4 commits from qu1ck_1337/solution/bvt2303-kraykin AGit into master
Showing only changes of commit d97571634f - Show all commits
+6 -1
View File
@@ -17,7 +17,12 @@ chat=c.call('POST','/api/v1/chats',201,actor=a,body={'title':'Lifecycle','member
marker='synthetic-private-body-marker';msg=c.message(a,chat,marker)['json']
container=compose('ps','-q','api')
inspect=lambda:json.loads(subprocess.check_output(['docker','inspect',container],text=True))[0]
before=inspect();assert before['Config']['User']=='10001:10001' and before['State']['Health']['Status']=='healthy'
before=inspect()
# HTTP readiness can precede Docker's next periodic healthcheck after restart.
deadline=time.monotonic()+20
while before['State']['Health']['Status']!='healthy' and time.monotonic()<deadline:
time.sleep(.2);before=inspect()
assert before['Config']['User']=='10001:10001' and before['State']['Health']['Status']=='healthy'
pid1=compose('exec','-T','api','cat','/proc/1/comm');assert pid1=='messenger'
start=time.monotonic();compose('stop','api');seconds=time.monotonic()-start
stopped=inspect();assert stopped['State']['ExitCode']==0 and not stopped['State']['OOMKilled'] and seconds<7