You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
814 B

import signal
import sys
from utils import *
from docker import rebuild_images_if_needed
from docker_compose import Compose
cluster = Compose()
def abort_handler(s, _):
warn(f'Received signal: {s}')
warn(f'Gracefully stopping...')
cluster.down()
def run_tests():
force_rebuild = '--rebuild' in sys.argv
preserve_containers = '--preserve' in sys.argv
for s in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP):
signal.signal(s, abort_handler)
rebuild_images_if_needed(force_rebuild)
try:
cluster.up()
cluster.is_alive()
cluster.run('cargo test --test integration')
except Exception as e:
err(e)
sys.exit(1)
finally:
if not preserve_containers:
cluster.down()
if __name__ == '__main__':
run_tests()