Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos
Commits
5924d5b3
Commit
5924d5b3
authored
Sep 29, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement first test.
parent
57aca877
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
software/end-to-end-testing/buildout.hash.cfg
software/end-to-end-testing/buildout.hash.cfg
+1
-1
software/end-to-end-testing/test_beremiz.py
software/end-to-end-testing/test_beremiz.py
+33
-3
No files found.
software/end-to-end-testing/buildout.hash.cfg
View file @
5924d5b3
...
@@ -12,4 +12,4 @@ md5sum = cbaa8e36097f36caf1a377fa71341a09
...
@@ -12,4 +12,4 @@ md5sum = cbaa8e36097f36caf1a377fa71341a09
[test_beremiz.py]
[test_beremiz.py]
filename = test_beremiz.py
filename = test_beremiz.py
md5sum =
184920492fc7e1a812e659d91a95a12
1
md5sum =
4e3263e01dc00e867ed70144219a355
1
software/end-to-end-testing/test_beremiz.py
View file @
5924d5b3
...
@@ -6,7 +6,6 @@ import unittest
...
@@ -6,7 +6,6 @@ import unittest
from
opcua
import
Client
from
opcua
import
Client
import
slapos.client
import
slapos.client
class
EndToEndTestCase
(
unittest
.
TestCase
):
class
EndToEndTestCase
(
unittest
.
TestCase
):
@
classmethod
@
classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
...
@@ -125,5 +124,36 @@ class BeremizTest(EndToEndTestCase):
...
@@ -125,5 +124,36 @@ class BeremizTest(EndToEndTestCase):
cls
.
waitUntilGreen
(
instance_name
)
cls
.
waitUntilGreen
(
instance_name
)
connection_dict
=
cls
.
getInstanceInfos
(
instance_name
).
connection_dict
connection_dict
=
cls
.
getInstanceInfos
(
instance_name
).
connection_dict
def
test_fail
(
self
):
def
test_plc_increment_run
(
self
):
self
.
assertEqual
(
0
,
1
)
NUMBER_OF_CHECKS
=
100
TIMEOUT
=
2
OPC_UA_ADDRESS
=
"opc.tcp://0.0.0.0:4840/"
OPC_UA_IDENTIFIER
=
"ns=1;s=i2c0.relay0"
# connect to a session at OPC-UA server
client
=
Client
(
OPC_UA_ADDRESS
)
# for now this is the only test thus we start it without a wrapper
test_count
=
1
test_failures
=
0
expected_failures
=
0
try
:
client
.
connect
()
root
=
client
.
get_root_node
()
children_list
=
root
.
get_children
()
var
=
client
.
get_node
(
OPC_UA_IDENTIFIER
)
for
i
in
range
(
0
,
NUMBER_OF_CHECKS
):
i2c0_relay0_before
=
var
.
get_value
()
print
(
"
\
n
i2c0_relay0 (before) = "
,
i2c0_relay0_before
)
print
(
"Sleep for %s seconds ..."
%
TIMEOUT
)
time
.
sleep
(
TIMEOUT
)
i2c0_relay0_after
=
var
.
get_value
()
print
(
"i2c0_relay0 (after) = "
,
i2c0_relay0_after
)
# for the wait timeout runtime should have increased the value
if
(
i2c0_relay0_after
<=
i2c0_relay0_before
):
# counter should have been increased, mark failure
test_failures
+=
1
finally
:
client
.
disconnect
()
# no failures
self
.
asserEqual
(
test_failures
,
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment