test: add go production acceptance smoke
This commit is contained in:
53
tools/test_go_prod_acceptance.py
Normal file
53
tools/test_go_prod_acceptance.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import argparse
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from tools import go_prod_acceptance as acceptance
|
||||
|
||||
|
||||
class GoProdAcceptanceTest(unittest.TestCase):
|
||||
def test_build_commands_runs_systemd_kafka_and_http_smokes(self):
|
||||
args = argparse.Namespace(
|
||||
app_host="115.29.187.205",
|
||||
kafka_host="114.55.58.251",
|
||||
ssh_user="root",
|
||||
base_url="http://115.29.187.205:20210",
|
||||
date="2026-07-02",
|
||||
timeout=8.0,
|
||||
max_lag=100,
|
||||
)
|
||||
|
||||
commands = acceptance.build_commands(args)
|
||||
|
||||
self.assertEqual(len(commands), 3)
|
||||
self.assertEqual(commands[0].name, "systemd")
|
||||
self.assertEqual(commands[0].argv[:2], [sys.executable, "tools/go_systemd_prod_smoke.py"])
|
||||
self.assertIn("--host", commands[0].argv)
|
||||
self.assertIn("115.29.187.205", commands[0].argv)
|
||||
self.assertEqual(commands[1].name, "kafka")
|
||||
self.assertIn("tools/go_kafka_prod_smoke.py", commands[1].argv)
|
||||
self.assertIn("--max-lag", commands[1].argv)
|
||||
self.assertEqual(commands[2].name, "http")
|
||||
self.assertIn("tools/go_native_prod_smoke.py", commands[2].argv)
|
||||
self.assertIn("--base-url", commands[2].argv)
|
||||
|
||||
def test_overall_status_fails_when_any_child_fails(self):
|
||||
results = [
|
||||
acceptance.ChildResult("systemd", "pass", 0, {"status": "pass"}),
|
||||
acceptance.ChildResult("kafka", "fail", 1, {"status": "fail"}),
|
||||
]
|
||||
|
||||
self.assertEqual(acceptance.overall_status(results), "fail")
|
||||
|
||||
def test_overall_status_passes_when_all_children_pass(self):
|
||||
results = [
|
||||
acceptance.ChildResult("systemd", "pass", 0, {"status": "pass"}),
|
||||
acceptance.ChildResult("kafka", "pass", 0, {"status": "pass"}),
|
||||
acceptance.ChildResult("http", "pass", 0, {"status": "pass"}),
|
||||
]
|
||||
|
||||
self.assertEqual(acceptance.overall_status(results), "pass")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user