Commit 52c3633d authored by Eteri's avatar Eteri

use putil for keep-alive test

parent 56d0240e
...@@ -14,6 +14,8 @@ import subprocess ...@@ -14,6 +14,8 @@ import subprocess
test_msg = "dummyInputSimpleIngest" test_msg = "dummyInputSimpleIngest"
caddy_pidfile = os.environ.get('CADDY_DIR') caddy_pidfile = os.environ.get('CADDY_DIR')
with open(caddy_pidfile) as f:
caddy_pid = f.readline()
if os.environ.get('DEBUG'): if os.environ.get('DEBUG'):
import logging import logging
...@@ -96,13 +98,20 @@ class TestIngestion(FluentdPluginTestCase): ...@@ -96,13 +98,20 @@ class TestIngestion(FluentdPluginTestCase):
start_fluentd_cat(self, test_msg, "tag_test_2") start_fluentd_cat(self, test_msg, "tag_test_2")
time.sleep(10) time.sleep(10)
self.assertEqual(test_msg, TestServerHandler.posted_data) self.assertEqual(test_msg, TestServerHandler.posted_data)
def test_keepAlive_on(self): def test_keepAlive_on(self):
print("############## TEST 3 ##############") print("############## TEST 3 ##############")
s = requests.session()
print("check connection type ") caddy_process = psutil.Process(int(caddy_pid))
print(s.headers['Connection']) port=9443
self.assertEqual('keep-alive', s.headers['Connection'])
start_fluentd_cat(self, "dummyInputDelayCheckKeepAlive", "tag_test_3")
time.sleep(10)
for conn in caddy_process.connections('inet'):
if len(conn.raddr) > 1 and conn.laddr.port == 4443:
self.assertEqual('ESTABLISHED', conn.status) #conn.status == 'ESTABLISHED' :
def test_ingest_with_15mins_delay(self): def test_ingest_with_15mins_delay(self):
''' '''
...@@ -124,9 +133,6 @@ class TestIngestion(FluentdPluginTestCase): ...@@ -124,9 +133,6 @@ class TestIngestion(FluentdPluginTestCase):
''' '''
print("############## TEST 5 ##############") print("############## TEST 5 ##############")
with open(caddy_pidfile) as f:
caddy_pid = f.readline()
start_fluentd_cat(self, "dummyInputCaddyRestart1", "tag_test_5_1") start_fluentd_cat(self, "dummyInputCaddyRestart1", "tag_test_5_1")
time.sleep(10) time.sleep(10)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment