Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
ff76eb27
Commit
ff76eb27
authored
Jun 1, 2022
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-786
: Split up some tests and avoid duplication of asserts across tests
parent
9f91d3e6
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!349
L2SS-786 observation and control tests + reverted L2SS-507-refactor-observation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/test/devices/test_observation_control_device.py
+39
-12
39 additions, 12 deletions
...oncontrol/test/devices/test_observation_control_device.py
with
39 additions
and
12 deletions
tangostationcontrol/tangostationcontrol/test/devices/test_observation_control_device.py
+
39
−
12
View file @
ff76eb27
...
...
@@ -65,6 +65,8 @@ class TestObservationControlDevice(base.TestCase, test_observation_base.TestObse
self
.
on_device_assert
(
proxy
)
self
.
assertFalse
(
proxy
.
is_any_observation_running
())
self
.
assertFalse
(
proxy
.
is_observation_running
(
12345
))
self
.
assertFalse
(
proxy
.
is_observation_running
(
54321
))
def
test_check_and_convert_parameters_invalid_id
(
self
):
"""
Test invalid parameter detection
"""
...
...
@@ -120,6 +122,26 @@ class TestObservationControlDevice(base.TestCase, test_observation_base.TestObse
self
.
assertTrue
(
proxy
.
is_any_observation_running
())
self
.
assertTrue
(
proxy
.
is_observation_running
(
12345
))
@mock.patch.object
(
observation_control
.
ObservationControl
,
'
delete_dynamic_device
'
)
def
test_start_observation_multiple
(
self
,
m_delete_device
):
"""
Test starting multiple observations
"""
self
.
mock_dynamic_devices
()
second_observation_json
=
json
.
loads
(
self
.
VALID_JSON
)
second_observation_json
[
'
observation_id
'
]
=
54321
with
DeviceTestContext
(
observation_control
.
ObservationControl
,
process
=
True
)
as
proxy
:
self
.
on_device_assert
(
proxy
)
proxy
.
start_observation
(
self
.
VALID_JSON
)
proxy
.
start_observation
(
json
.
dumps
(
second_observation_json
))
self
.
assertTrue
(
proxy
.
is_any_observation_running
())
self
.
assertTrue
(
proxy
.
is_observation_running
(
12345
))
self
.
assertTrue
(
proxy
.
is_observation_running
(
54321
))
def
test_stop_observation_invalid_id
(
self
):
"""
Test stop_observation exceptions for invalid ids
"""
...
...
@@ -138,6 +160,20 @@ class TestObservationControlDevice(base.TestCase, test_observation_base.TestObse
self
.
assertRaises
(
DevFailed
,
proxy
.
stop_observation
,
2
)
def
test_is_any_observation_running_after_stop_all_observations
(
self
):
"""
Test whether is_any_observation_running conforms when we start & stop an observation
"""
self
.
mock_dynamic_devices
()
with
DeviceTestContext
(
observation_control
.
ObservationControl
,
process
=
True
)
as
proxy
:
self
.
on_device_assert
(
proxy
)
proxy
.
start_observation
(
self
.
VALID_JSON
)
proxy
.
stop_all_observations
()
# Test false
self
.
assertFalse
(
proxy
.
is_any_observation_running
())
def
test_start_stop_observation
(
self
):
"""
Test starting and stopping an observation
"""
self
.
mock_dynamic_devices
()
...
...
@@ -148,15 +184,9 @@ class TestObservationControlDevice(base.TestCase, test_observation_base.TestObse
# uses ID 12345
proxy
.
start_observation
(
self
.
VALID_JSON
)
# Test true
self
.
assertTrue
(
proxy
.
is_any_observation_running
())
self
.
assertTrue
(
proxy
.
is_observation_running
(
12345
))
proxy
.
stop_observation
(
12345
)
# Test false
self
.
assertFalse
(
proxy
.
is_any_observation_running
())
self
.
assertFalse
(
proxy
.
is_observation_running
(
12345
))
def
test_start_multi_stop_all_observation
(
self
):
...
...
@@ -173,11 +203,8 @@ class TestObservationControlDevice(base.TestCase, test_observation_base.TestObse
# uses ID 12345
proxy
.
start_observation
(
self
.
VALID_JSON
)
proxy
.
start_observation
(
json
.
dumps
(
second_observation_json
))
self
.
assertTrue
(
proxy
.
is_any_observation_running
())
self
.
assertTrue
(
proxy
.
is_observation_running
(
12345
))
self
.
assertTrue
(
proxy
.
is_observation_running
(
54321
))
proxy
.
stop_all_observations
()
self
.
assertFalse
(
proxy
.
is_any_observation_running
())
# Test false
self
.
assertFalse
(
proxy
.
is_observation_running
(
12345
))
self
.
assertFalse
(
proxy
.
is_observation_running
(
54321
))
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