Skip to content

Commit

Permalink
set up results dir and cluster log location
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidzr committed Jun 8, 2020
1 parent 7698770 commit 418430d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions webui/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
results/
*.log
14 changes: 11 additions & 3 deletions webui/tests/bin/e2e-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
webui_dir = root_path.joinpath("webui")
tests_dir = webui_dir.joinpath("tests")
results_dir = tests_dir.joinpath("results")
test_cluster_dir = tests_dir.joinpath("test-cluster")

CLUSTER_CMD_PREFIX = ["make", "-C", "test-cluster"]
CLUSTER_CMD_PREFIX = ["make", "-C", str(test_cluster_dir)]

CLEAR = "\033[39m"
BLUE = "\033[94m"
Expand All @@ -42,6 +43,11 @@ def run_ignore_failure(cmd: List[str], config):
pass


def setup_results_dir(config):
run_ignore_failure(["rm", "-r", str(results_dir)], config)
run(["mkdir", "-p", str(results_dir)], config)


def setup_cluster(logfile, config):
logger.info("setting up the cluster..")
run(CLUSTER_CMD_PREFIX + ["start-db"], config)
Expand All @@ -63,16 +69,17 @@ def teardown_cluster(config):
@contextmanager
def det_cluster(config):
try:
with open(str(results_dir.joinpath("cluster.stdout.logs")), "w") as f:
log_path = str(test_cluster_dir.joinpath("cluster.stdout.log"))
with open(log_path, "w") as f:
yield setup_cluster(f, config)

finally:
teardown_cluster(config)


def pre_e2e_tests(config):
run_ignore_failure(["rm", "-r", str(results_dir)], config)
# TODO add a check for cluster condition
setup_results_dir(config)
run(
["python", str(tests_dir.joinpath("bin", "createUserAndExperiments.py"))],
config,
Expand Down Expand Up @@ -122,6 +129,7 @@ def cypress_open(config):


def e2e_tests(config):
setup_results_dir(config)
with det_cluster(config):
pre_e2e_tests(config)
run_e2e_tests(config)
Expand Down

0 comments on commit 418430d

Please sign in to comment.