Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
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
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
a7801df7
Commit
a7801df7
authored
5 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
extended logical test coverage for testStatusModule, and streamlined the test logic.
parent
ef247d0c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/executables_src/testStatusModule.cc
+121
-29
121 additions, 29 deletions
tests/executables_src/testStatusModule.cc
with
121 additions
and
29 deletions
tests/executables_src/testStatusModule.cc
+
121
−
29
View file @
a7801df7
...
@@ -45,17 +45,17 @@ BOOST_AUTO_TEST_CASE(testMaxMonitor) {
...
@@ -45,17 +45,17 @@ BOOST_AUTO_TEST_CASE(testMaxMonitor) {
//app.cs.dump();
//app.cs.dump();
auto
warning
=
test
.
getScalar
<
double_t
>
(
std
::
string
(
"/Monitor/upperWarningThreshold"
));
auto
warning
=
test
.
getScalar
<
double_t
>
(
std
::
string
(
"/Monitor/upperWarningThreshold"
));
warning
=
45.1
;
warning
=
50.0
;
warning
.
write
();
warning
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
auto
error
=
test
.
getScalar
<
double_t
>
(
std
::
string
(
"/Monitor/upperErrorThreshold"
));
auto
error
=
test
.
getScalar
<
double_t
>
(
std
::
string
(
"/Monitor/upperErrorThreshold"
));
error
=
5
0.
1
;
error
=
6
0.
0
;
error
.
write
();
error
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
auto
watch
=
test
.
getScalar
<
double_t
>
(
std
::
string
(
"/watch"
));
auto
watch
=
test
.
getScalar
<
double_t
>
(
std
::
string
(
"/watch"
));
watch
=
40.
1
;
watch
=
40.
0
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
...
@@ -65,62 +65,67 @@ BOOST_AUTO_TEST_CASE(testMaxMonitor) {
...
@@ -65,62 +65,67 @@ BOOST_AUTO_TEST_CASE(testMaxMonitor) {
//should be in OK state.
//should be in OK state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
//
set watch value exceeding
warning level
//
//just below the
warning level
watch
=
4
6.1
;
watch
=
4
9.99
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in WARNING state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
//
set watch value exceeding error level
//
slightly above at the upper warning threshold (exact is not good due to rounding errors in floats/doubles)
watch
=
5
1.
1
;
watch
=
5
0.0
1
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in ERROR state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
//
increase error value greater than watch
//
just below the error threshold,. still warning
error
=
60.1
;
watch
=
59.99
;
error
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in WARNING state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
//
increase warning value greater than watch
//
slightly above at the upper error threshold (exact is not good due to rounding errors in floats/doubles)
wa
rning
=
55.
1
;
wa
tch
=
60.0
1
;
wa
rning
.
write
();
wa
tch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in OK state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
//se
t
w
atch value exceeding
error level
//
increa
se w
ell above the upper
error level
watch
=
65
.1
;
watch
=
65
;
watch
.
write
();
watch
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in ERROR state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
//decrease watch value lower than error level but still greater than warning level
// now check that changing the status is updated correctly if we change the limits
watch
=
58.1
;
watch
.
write
();
//increase error value greater than watch
error
=
68
;
error
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in WARNING state.
//should be in WARNING state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
//
de
crease wa
tch
value
low
er than wa
rning level
//
in
crease wa
rning
value
great
er than wa
tch
wa
tch
=
54.1
;
wa
rning
=
66
;
wa
tch
.
write
();
wa
rning
.
write
();
test
.
stepApplication
();
test
.
stepApplication
();
status
.
readLatest
();
status
.
readLatest
();
//should be in OK state.
//should be in OK state.
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// Set the upper error limit below the upper warning limit and below the current temperature. The warning is not active, but the error.
// Although this is not a reasonable configuration the error limit must superseed the warning and the status has to be error.
error
=
60
;
error
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// check that the tags are applied correctly
// check that the tags are applied correctly
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
...
@@ -195,6 +200,35 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
...
@@ -195,6 +200,35 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
status
.
readLatest
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// move the temperature back to the good range and check that the status updates correctly when changing the limits
watch
=
41
;
watch
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// change upper warning limit
warning
=
42
;
warning
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
// rise the temperature above the lower warning limit
watch
=
43
;
watch
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// Set the lower error limit above the lower warning limit. The warning is not active, but the error.
// Although this is not a reasonable configuration the error limit must superseed the warning and the status has to be error.
error
=
44
;
error
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// check that the tags are applied correctly
// check that the tags are applied correctly
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
...
@@ -314,6 +348,64 @@ BOOST_AUTO_TEST_CASE(testRangeMonitor) {
...
@@ -314,6 +348,64 @@ BOOST_AUTO_TEST_CASE(testRangeMonitor) {
status
.
readLatest
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// Put the value back to the good range, then check that chaning the threshold also updated the status
watch
=
49
;
watch
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// change upper warning limit
warningUpperLimit
=
48
;
warningUpperLimit
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
// lower the temperature below the upper warning limit
watch
=
47
;
watch
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// Set the upper error limit below the upper warning limit. The warning is not active, but the error.
// Although this is not a reasonable configuration the error limit must superseed the warning and the status has to be error.
errorUpperLimit
=
46
;
errorUpperLimit
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// move the temperature back to the good range and repeat for the lower limits
watch
=
41
;
watch
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// change upper warning limit
warningLowerLimit
=
42
;
warningLowerLimit
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
WARNING
);
// rise the temperature above the lower warning limit
watch
=
43
;
watch
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
OK
);
// Set the lower error limit above the lower warning limit. The warning is not active, but the error.
// Although this is not a reasonable configuration the error limit must superseed the warning and the status has to be error.
errorLowerLimit
=
44
;
errorLowerLimit
.
write
();
test
.
stepApplication
();
status
.
readLatest
();
BOOST_CHECK_EQUAL
(
status
,
ChimeraTK
::
States
::
ERROR
);
// check that the tags are applied correctly
// check that the tags are applied correctly
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MyNiceMonitorCopy/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
BOOST_CHECK_EQUAL
(
status
,
test
.
readScalar
<
uint16_t
>
(
"/MonitorOutput/Monitor/status"
));
...
...
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