Skip to content
GitLab
Explore
Sign in
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
af43aaec
Commit
af43aaec
authored
3 years ago
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-340
: Very early sst device connectivity tests
parent
5d1847d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!117
create TCPReplicator for StatisticsClient
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
devices/integration_test/devices/test_device_sst.py
+77
-0
77 additions, 0 deletions
devices/integration_test/devices/test_device_sst.py
devices/test/clients/test_tcp_replicator.py
+2
-2
2 additions, 2 deletions
devices/test/clients/test_tcp_replicator.py
with
79 additions
and
2 deletions
devices/integration_test/devices/test_device_sst.py
0 → 100644
+
77
−
0
View file @
af43aaec
# -*- coding: utf-8 -*-
#
# This file is part of the LOFAR 2.0 Station Software
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.
import
socket
import
time
from
tango
import
DeviceProxy
from
tango._tango
import
DevState
from
integration_test
import
base
class
TestDeviceSST
(
base
.
IntegrationTestCase
):
def
setUp
(
self
):
"""
Intentionally recreate the device object in each test
"""
super
(
TestDeviceSST
,
self
).
setUp
()
def
tearDown
(
self
):
"""
Turn device Off in teardown to prevent blocking tests
"""
d
=
DeviceProxy
(
"
LTS/SST/1
"
)
try
:
d
.
Off
()
except
Exception
as
e
:
"""
Failing to turn Off devices should not raise errors here
"""
print
(
f
"
Failed to turn device off in teardown
{
e
}
"
)
def
test_device_proxy_sst
(
self
):
"""
Test if we can successfully create a DeviceProxy and fetch state
"""
d
=
DeviceProxy
(
"
LTS/SST/1
"
)
self
.
assertEqual
(
DevState
.
OFF
,
d
.
state
())
def
test_device_sst_initialize
(
self
):
"""
Test if we can transition to standby
"""
d
=
DeviceProxy
(
"
LTS/SST/1
"
)
d
.
initialise
()
self
.
assertEqual
(
DevState
.
STANDBY
,
d
.
state
())
def
test_device_sst_on
(
self
):
"""
Test if we can transition to on
"""
d
=
DeviceProxy
(
"
LTS/SST/1
"
)
d
.
initialise
()
d
.
on
()
self
.
assertEqual
(
DevState
.
ON
,
d
.
state
())
def
test_device_sst_send_udp
(
self
):
d
=
DeviceProxy
(
"
LTS/SST/1
"
)
d
.
initialise
()
self
.
assertEqual
(
DevState
.
STANDBY
,
d
.
state
())
d
.
on
()
self
.
assertEqual
(
DevState
.
ON
,
d
.
state
())
s1
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
s1
.
connect
((
"
127.0.0.1
"
,
5002
))
# TODO(Corne): Change me into an actual SST packet
s1
.
send
(
"
Hello World!
"
.
encode
(
"
UTF-8
"
))
This diff is collapsed.
Click to expand it.
devices/test/clients/test_tcp_replicator.py
+
2
−
2
View file @
af43aaec
...
@@ -49,7 +49,7 @@ class TestTCPReplicator(base.TestCase):
...
@@ -49,7 +49,7 @@ class TestTCPReplicator(base.TestCase):
# Patch _process_queue and force match spec
# Patch _process_queue and force match spec
process_queue_patcher
=
mock
.
patch
.
object
(
process_queue_patcher
=
mock
.
patch
.
object
(
self
.
m_tcp_replicator
,
'
_process_queue
'
,
self
.
m_tcp_replicator
,
'
_process_queue
'
,
spec
=
T
CPReplicator
.
_process_que
ue
,
return_value
=
self
.
dummy_task
())
auto
spec
=
T
r
ue
,
return_value
=
self
.
dummy_task
())
self
.
m_process_queue
=
process_queue_patcher
.
start
()
self
.
m_process_queue
=
process_queue_patcher
.
start
()
self
.
addCleanup
(
process_queue_patcher
.
stop
)
self
.
addCleanup
(
process_queue_patcher
.
stop
)
...
@@ -155,7 +155,7 @@ class TestTCPReplicator(base.TestCase):
...
@@ -155,7 +155,7 @@ class TestTCPReplicator(base.TestCase):
def
test_queue_start
(
self
):
def
test_queue_start
(
self
):
replicator
=
self
.
m_tcp_replicator
(
self
.
m_queue
)
replicator
=
self
.
m_tcp_replicator
(
self
.
m_queue
)
self
.
m_process_queue
.
assert_called_once_with
()
self
.
m_process_queue
.
assert_called_once_with
(
replicator
)
def
test_transmit_queue
(
self
):
def
test_transmit_queue
(
self
):
m_data
=
"
Hello World!
"
.
encode
(
'
utf-8
'
)
m_data
=
"
Hello World!
"
.
encode
(
'
utf-8
'
)
...
...
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