Skip to content
Snippets Groups Projects
Commit 825799a4 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

fix tests

parent 6400b821
Branches
No related tags found
1 merge request!115Resolve "declutter the top level log file"
Pipeline #382813 passed
...@@ -302,30 +302,41 @@ def test_install_environment_zlib(): ...@@ -302,30 +302,41 @@ def test_install_environment_zlib():
# print("Debug here ") # print("Debug here ")
# time.sleep(10) # time.sleep(10)
build_log = list( log_files = list(
(release_base_dir / "logs").glob( (release_base_dir / "logs").glob(
f"{mpsd_release_to_test}_{microarch}_*_install.log" f"{mpsd_release_to_test}_{microarch}_*_install.log"
) )
) )
assert len(build_log) == 2 assert len(log_files) == 2
# take the most recent build log # take the most recent log as build log
build_log = sorted(build_log)[1] apex_log = sorted(log_files)[0]
build_log = sorted(log_files)[1]
assert "APEX" in str(apex_log)
assert "BUILD" in str(build_log)
# check that the build log contains statement ##### Installation finished # check that the build log contains statement ##### Installation finished
with open(build_log, "r") as f: with open(build_log, "r") as f:
lines = f.read() lines = f.read()
assert "##### Installation finished" in lines assert "##### Installation finished" in lines
os.path.basename(build_log) os.path.basename(build_log)
# assert that install log files exists # assert that APEX log file points to the build log file
with open(apex_log, "r") as f:
lines = f.read()
assert (
f"> Logging installation of {package_set_to_test} at {build_log}" in lines
)
# assert that cmd log files exists
assert os.path.exists(root_dir / cmd_log_file) assert os.path.exists(root_dir / cmd_log_file)
# assert that the build log is written to the install log file # assert that the mpsd release and hash is written to the cmd log file
os.path.basename(build_log) os.path.basename(build_log)
with open(root_dir / cmd_log_file, "r") as f: with open(root_dir / cmd_log_file, "r") as f:
lines = f.read() lines = f.read()
assert ( assert f"Spack environments branch: releases/{mpsd_release_to_test}" in lines
f"installing {package_set_to_test} and logging at {str(build_log)}" in lines # assert (
) # f"> logging to {apex_log}" in lines
# ) # TODO this has to be tested when main() called ie via CLI
# assert that the module files are created correctly # assert that the module files are created correctly
assert os.path.exists(release_base_dir / microarch) assert os.path.exists(release_base_dir / microarch)
assert os.path.exists(release_base_dir / microarch / "lmod") assert os.path.exists(release_base_dir / microarch / "lmod")
...@@ -673,6 +684,9 @@ def test_interface(tmp_path): ...@@ -673,6 +684,9 @@ def test_interface(tmp_path):
# check that the help message is printed when -h is provided # check that the help message is printed when -h is provided
# check that the error messages are also logged to the log file # check that the error messages are also logged to the log file
# check that `/` in release is handled correctly # check that `/` in release is handled correctly
# check that the cmd_log file contains sys arguments
# check that the cmd_log file contains the script version for init
# check that the cmd_log file contains the location of APEX log
# other tests to add (ideally) # other tests to add (ideally)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment