Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CastorScript
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
atlas-tdaq-software
CastorScript
Merge requests
!29
Resolve "Initial Publish uptime of CS instance to IS"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Initial Publish uptime of CS instance to IS"
22-initial-publish-uptime-of-cs-instance-to-is
into
master
Overview
26
Commits
25
Pipelines
14
Changes
4
Merged
Jonas Ladefoged Holm
requested to merge
22-initial-publish-uptime-of-cs-instance-to-is
into
master
6 years ago
Overview
16
Commits
25
Pipelines
14
Changes
5
Expand
Closes
#22 (closed)
Edited
5 years ago
by
Jonas Ladefoged Holm
0
0
Merge request reports
Compare
version 1
version 12
ca0786e7
5 years ago
version 11
116e0df2
5 years ago
version 10
d1c5b6b5
5 years ago
version 9
59a94032
5 years ago
version 8
0a4f00ae
5 years ago
version 7
e74a4de2
5 years ago
version 6
e74a4de2
5 years ago
version 5
b203f340
6 years ago
version 4
26fd6591
6 years ago
version 3
7afcde58
6 years ago
version 2
95d3b39d
6 years ago
version 1
1e2a37c7
6 years ago
master (base)
and
version 3
latest version
2ce1a5b7
25 commits,
5 years ago
version 12
ca0786e7
24 commits,
5 years ago
version 11
116e0df2
23 commits,
5 years ago
version 10
d1c5b6b5
15 commits,
5 years ago
version 9
59a94032
12 commits,
5 years ago
version 8
0a4f00ae
11 commits,
5 years ago
version 7
e74a4de2
10 commits,
5 years ago
version 6
e74a4de2
10 commits,
5 years ago
version 5
b203f340
6 commits,
6 years ago
version 4
26fd6591
5 commits,
6 years ago
version 3
7afcde58
4 commits,
6 years ago
version 2
95d3b39d
3 commits,
6 years ago
version 1
1e2a37c7
1 commit,
6 years ago
Show latest version
5 files
+
102
−
56
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
Script/UnitTests/Info
rmation
ServiceThread_Test.py
→
Script/UnitTests/InfoServiceThread_Test.py
+
18
−
12
Options
@@ -9,11 +9,11 @@ if __name__ == '__main__':
SCRIPT_DIR
=
abspath
(
join
(
dirname
(
__file__
),
'
..
'
))
sys
.
path
.
append
(
SCRIPT_DIR
)
from
cs.Threads.Info
rmation
ServiceThread
import
Info
rmation
ServiceThread
from
cs.Threads.InfoServiceThread
import
InfoServiceThread
from
cs.Tools.ConfigParser
import
ConfigHolder
# as a developer I want to publish information to the information service
class
TestInfo
rmation
ServiceThread
(
unittest
.
TestCase
):
class
TestInfoServiceThread
(
unittest
.
TestCase
):
def
setUp
(
self
):
## we mock the event so that the thread won't be left hanging
@@ -23,22 +23,28 @@ class TestInformationServiceThread(unittest.TestCase):
## we mock the configuration
self
.
mock_cfg
=
mock
.
create_autospec
(
ConfigHolder
)
self
.
mock_cfg
.
configure_mock
(
partition
=
"
initial
"
,
LogDir
=
""
,
LogLevel
=
""
)
self
.
mock_cfg
.
configure_mock
(
partition
=
"
initial
"
,
LogDir
=
""
,
LogLevel
=
""
,
FileName
=
"
Conf_test.cfg
"
)
class
TestInfoServiceExit
(
TestInformationServiceThread
):
## we're not interested in any logging for this test
with
mock
.
patch
(
"
cs.Threads.InfoServiceThread.enable_file_logging
"
):
self
.
info_thread
=
InfoServiceThread
(
self
.
mock_cfg
,
self
.
mock_event
)
class
TestInfoServiceExit
(
TestInfoServiceThread
):
def
test_it_should_stop_thread_execution
(
self
):
## we're not interested in any logging for this test
with
mock
.
patch
(
"
cs.Threads.InformationServiceThread.enable_file_logging
"
):
# I run the thread
info_thread
=
InformationServiceThread
(
self
.
mock_cfg
,
self
.
mock_event
)
info_thread
.
start
()
# I run the thread
self
.
info_thread
.
start
()
# and shut it down
info_thread
.
info_service_exit
()
info_thread
.
join
(
3.0
)
self
.
info_thread
.
info_service_exit
()
self
.
info_thread
.
join
(
3.0
)
# and I see that the thread has been killed
self
.
assertFalse
(
info_thread
.
is_alive
(),
msg
=
"
InformationService Thread didn
'
t die
"
)
self
.
assertFalse
(
self
.
info_thread
.
is_alive
(),
msg
=
"
InfoService Thread didn
'
t die
"
)
class
TestGetProcessUptime
(
TestInfoServiceThread
):
def
test_uptime_should_be_positive
(
self
):
self
.
assertGreaterEqual
(
self
.
info_thread
.
get_process_uptime_in_seconds
(),
0
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
Loading