1import io
2import os
3import re
4import ssl
5import subprocess
6import unittest
7from unit.applications.tls import TestApplicationTLS
8

--- 507 unchanged lines hidden (view full) ---

516
517 self.assertIn(
518 'success',
519 self.conf_delete('/certificates'),
520 'remove all certificates',
521 )
522
523 def test_tls_application_respawn(self):
524 self.skip_alerts.append(r'process \d+ exited on signal 9')
524 self.load('mirror')
525
526 self.certificate()
527
528 self.conf('1', 'applications/mirror/processes')
529
530 self.add_tls(application='mirror')
531
533 (resp, sock) = self.post_ssl(
532 (_, sock) = self.post_ssl(
533 headers={
534 'Host': 'localhost',
535 'Connection': 'keep-alive',
536 'Content-Type': 'text/html',
537 },
538 start=True,
539 body='0123456789',
540 read_timeout=1,
541 )
542
543 app_id = self.findall(r'(\d+)#\d+ "mirror" application started')[0]
544
545 subprocess.call(['kill', '-9', app_id])
546
547 self.skip_alerts.append(r'process %s exited on signal 9' % app_id)
548
549 self.wait_for_record(
550 re.compile(
551 ' (?!' + app_id + '#)(\d+)#\d+ "mirror" application started'
552 )
553 )
554
555 resp = self.post_ssl(
556 headers={

--- 68 unchanged lines hidden ---