Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mpsd-software-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MPSD Computational Science
mpsd-software-manager
Commits
825799a4
Commit
825799a4
authored
1 year ago
by
Ashwin Kumar Karnad
Browse files
Options
Downloads
Patches
Plain Diff
fix tests
parent
6400b821
Branches
Branches containing commit
No related tags found
1 merge request
!115
Resolve "declutter the top level log file"
Pipeline
#382813
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_mpsd_software.py
+23
-9
23 additions, 9 deletions
tests/test_mpsd_software.py
with
23 additions
and
9 deletions
tests/test_mpsd_software.py
+
23
−
9
View file @
825799a4
...
@@ -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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment