11#!/usr/bin/env python3
22
3- import logging
43import os
5- import threading
64from datetime import datetime
75from pathlib import Path
8- from subprocess import PIPE , Popen
96
107import requests
118from test_base import TestBase
@@ -18,39 +15,15 @@ def __init__(self):
1815 super ().__init__ ()
1916 self .network_dir = Path (os .path .dirname (__file__ )) / "data" / "logging"
2017 self .scripts_dir = Path (os .path .dirname (__file__ )) / ".." / "resources" / "scripts"
21- self .connect_logging_process = None
22- self .connect_logging_thread = None
23- self .connect_logging_logger = logging .getLogger ("cnct_log" )
2418
2519 def run_test (self ):
2620 try :
2721 self .setup_network ()
28- self .start_logging ()
22+ self .wait_for_endpoint_ready ()
2923 self .test_prometheus_and_grafana ()
3024 finally :
31- if self .connect_logging_process is not None :
32- self .log .info ("Terminating background connect_logging.sh process..." )
33- self .connect_logging_process .terminate ()
3425 self .cleanup ()
3526
36- def start_logging (self ):
37- # Stays alive in background
38- self .connect_logging_process = Popen (
39- [f"{ self .scripts_dir / 'connect_logging.sh' } " ],
40- stdout = PIPE ,
41- stderr = PIPE ,
42- bufsize = 1 ,
43- universal_newlines = True ,
44- )
45- self .log .info ("connect_logging.sh started..." )
46- self .connect_logging_thread = threading .Thread (
47- target = self .output_reader ,
48- args = (self .connect_logging_process .stdout , self .connect_logging_logger .info ),
49- )
50- self .connect_logging_thread .daemon = True
51- self .connect_logging_thread .start ()
52- self .wait_for_endpoint_ready ()
53-
5427 def setup_network (self ):
5528 self .log .info ("Setting up network" )
5629 self .log .info (self .warnet (f"deploy { self .network_dir } " ))
0 commit comments