Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
eaee0aa2
Commit
eaee0aa2
authored
4 years ago
by
Nathan Hertz
Browse files
Options
Downloads
Patches
Plain Diff
Added comments to test_wf_monitor
parent
553f94ca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/cli/utilities/wf_monitor/test/test_wf_monitor.py
+23
-1
23 additions, 1 deletion
apps/cli/utilities/wf_monitor/test/test_wf_monitor.py
with
23 additions
and
1 deletion
apps/cli/utilities/wf_monitor/test/test_wf_monitor.py
+
23
−
1
View file @
eaee0aa2
...
...
@@ -11,6 +11,10 @@ WORKFLOW_STATUS_EXCH = 'workspaces.workflow-service.workflow-status'
def
test_read_log
():
"""
Tests whether or not the example log is being correctly read by checking for strings known to
exist in the example log file
"""
test_strs
=
[
'
Image size of job updated: 432
'
,
'
432 - ResidentSetSize of job (KB)
'
,
...
...
@@ -22,7 +26,10 @@ def test_read_log():
assert
s
in
test_monitor
.
log
def
test_read_log_timeout
(
capsys
):
def
test_read_log_timeout
():
"""
Tests the timeout functionality of WorkflowMonitor.read_htcondor_log()
"""
with
pytest
.
raises
(
SystemExit
)
as
sys_ex
:
WorkflowMonitor
(
'
logs/file-that-does-not-exist.txt
'
,
1
)
assert
sys_ex
.
type
==
SystemExit
...
...
@@ -30,6 +37,10 @@ def test_read_log_timeout(capsys):
def
test_parse_log
():
"""
Tests that the example log file is correctly parsed by checking for the known order of event
types
"""
test_event_types
=
[
WorkflowEventType
.
SUBMITTED
,
WorkflowEventType
.
EXECUTING
,
...
...
@@ -45,12 +56,23 @@ def test_parse_log():
def
test_parse_log_error
():
"""
Tests that WorkflowMonitor.parse_log() correctly raises a ValueError when a badly formatted
log is parsed
"""
with
pytest
.
raises
(
ValueError
)
as
val_err
:
WorkflowMonitor
(
'
logs/test.log
'
)
assert
val_err
.
type
==
ValueError
def
test_monitor_events
(
mocker
:
MockerFixture
):
"""
Test that mocks the core wf_monitor functionality of creating a connection to the RabbitMQ
server, configuring a channel with that connection, and emitting events through that channel
:param mocker: Pytest fixture from pytest_mock that wraps the real function and mimics that
its been called as normal; allows for testing interaction with the server without actually
requiring a connection to the server
"""
mock_list
=
[
'
pika.adapters.blocking_connection.BlockingChannel.basic_publish
'
,
'
channels.amqp_helpers.make_amqp_connection
'
,
...
...
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