Skip to content

Commit 48bb1ac

Browse files
send infra log error in case of infra failure (#1701)
1 parent 5f3ce2b commit 48bb1ac

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

terraform/kafka_runner/run-test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,20 @@ def main():
295295
logging.debug(f'starting with cluster: {f.read()}')
296296

297297
test_runner.wait_until_ready()
298+
except Exception as ex:
299+
file_path = "~/infra_failure.log"
300+
file_expanded = os.path.expanduser(file_path)
301+
error_txt = "INFRA_FAILURE " + str(ex)
302+
logging.error(error_txt)
303+
with open(file_expanded, "w") as f:
304+
f.write(error_txt)
305+
logging.info("bringing down terraform cluster")
306+
test_runner.destroy_terraform()
307+
sys.exit(1)
308+
309+
logging.info("Cluster is up and running")
310+
311+
try:
298312

299313
source= os.path.join(os.environ.get('WORKSPACE'),'kafka')
300314

0 commit comments

Comments
 (0)