Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
flame
flame-clmc
Commits
d014c0ef
Commit
d014c0ef
authored
6 years ago
by
MJB
Browse files
Options
Downloads
Patches
Plain Diff
removed old tests
parent
cdb76d97
No related branches found
Branches containing commit
Tags
1.1.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/clmctest/inputs/test_systemctl_mon.py
+0
-64
0 additions, 64 deletions
src/test/clmctest/inputs/test_systemctl_mon.py
with
0 additions
and
64 deletions
src/test/clmctest/inputs/test_systemctl_mon.py
deleted
100644 → 0
+
0
−
64
View file @
cdb76d97
#!/usr/bin/python3
"""
## © University of Southampton IT Innovation Centre, 2018
##
## Copyright in this software belongs to University of Southampton
## IT Innovation Centre of Gamma House, Enterprise Road,
## Chilworth Science Park, Southampton, SO16 7NS, UK.
##
## This software may not be used, sold, licensed, transferred, copied
## or reproduced in whole or in part in any manner or form or in or
## on any media by any person other than in accordance with the terms
## of the Licence Agreement supplied with the software, or otherwise
## without the prior written consent of the copyright owners.
##
## This software is distributed WITHOUT ANY WARRANTY, without even the
## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE, except where stated in the Licence Agreement supplied with
## the software.
##
## Created By : Michael Boniface
## Created Date : 29-04-2018
## Created for Project : FLAME
"""
import
pytest
import
time
import
random
import
logging
import
sys
from
systemctl_monitor
import
SystemctlMonitor
URL
=
"
localhost
"
PORT
=
"
8186
"
DATABASE
=
"
CLMCMetrics
"
@pytest.mark.parametrize
(
"
service_name
"
,
[(
'
nginx
'
)])
def
test_create_measurement
(
telegraf_agent_config
,
service_name
):
service
=
'
unknown
'
for
s
in
telegraf_agent_config
[
'
hosts
'
]:
if
s
[
'
name
'
]
==
service_name
:
service
=
s
continue
assert
service
!=
'
unknown
'
,
"
{0} not in list of hosts
"
.
format
(
service_name
)
mon
=
SystemctlMonitor
(
service_name
,
2
,
10
,
service
[
'
ip_address
'
],
8186
,
service
[
'
database_name
'
])
report
=
{
'
time
'
:
1526042434.1773288
,
'
fields
'
:
{
'
loaded.active.running_sum
'
:
231.85903143882751
,
'
current_state_time
'
:
231.85903143882751
,
'
current_state
'
:
'
loaded.active.running
'
,
'
loaded.active.running_count
'
:
1
}}
measurement
=
mon
.
create_measurement
(
report
)
assert
measurement
[
0
][
'
tags
'
][
'
resource_name
'
]
==
service_name
assert
measurement
[
0
][
'
fields
'
][
'
current_state
'
]
==
report
[
'
fields
'
][
'
current_state
'
]
def
test_get_systemctl_status
(
telegraf_agent_config
):
mon
=
SystemctlMonitor
(
'
nginx
'
,
2
,
10
,
URL
,
PORT
,
DATABASE
)
state
=
mon
.
get_systemctl_status
(
'
nginx
'
)
assert
state
==
'
loaded.active.running
'
def
test_monitor
(
telegraf_agent_config
):
mon
=
SystemctlMonitor
(
'
nginx
'
,
2
,
10
,
URL
,
PORT
,
DATABASE
)
mon
.
start
()
time
.
sleep
(
21
)
mon
.
stop
()
measurement
=
mon
.
get_current_measurement
()
print
(
"
Current measurement: {0}
"
.
format
(
str
(
measurement
)))
\ No newline at end of file
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