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
5937d758
Commit
5937d758
authored
7 years ago
by
Simon Crowle
Browse files
Options
Downloads
Patches
Plain Diff
Adds tests for averaging average state times per sample period
Seeds random number generation for predictable results
parent
9e307f70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clmctest/monitoring/test_simresults.py
+21
-1
21 additions, 1 deletion
clmctest/monitoring/test_simresults.py
with
21 additions
and
1 deletion
clmctest/monitoring/test_simresults.py
+
21
−
1
View file @
5937d758
...
...
@@ -2,6 +2,7 @@
import
pytest
import
time
import
random
class
TestSimulation
(
object
):
...
...
@@ -10,11 +11,17 @@ class TestSimulation(object):
"""
@pytest.fixture
(
scope
=
'
class
'
)
def
run_simulator
(
self
,
simulator
):
random
.
seed
(
0
)
# Seed random function so we can reliably test for average queries
print
(
"
Running simulation, please wait...
"
)
simulator
.
run
(
3600
)
print
(
"
Waiting for INFLUX to finish receiving simulation data...
"
)
time
.
sleep
(
10
)
# wait for data to finish arriving at the INFLUX database
print
(
"
... simulation data fixture finished
"
)
@pytest.mark.parametrize
(
"
query, expected_result
"
,
[
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
cpu_usage
"'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_cpu_active_time
"
:
7200
,
"
count_cpu_idle_time
"
:
7200
,
"
count_cpu_usage
"
:
7200
}),
...
...
@@ -26,12 +33,25 @@ class TestSimulation(object):
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_RX_BYTES_PORT_M
"
:
7200
,
"
count_TX_BYTES_PORT_M
"
:
7200
}),
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
vm_res_alloc
"'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_cpu
"
:
12
,
"
count_memory
"
:
12
,
"
count_storage
"
:
12
}),
# Media component state tests
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache1
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
3604
,
"
count_avg_starting
"
:
3604
,
"
count_avg_stopped
"
:
3604
,
"
count_avg_stopping
"
:
3604
,
"
count_running
"
:
3604
,
"
count_starting
"
:
3604
,
"
count_stopped
"
:
3604
,
"
count_stopping
"
:
3604
}),
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache2
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
3604
,
"
count_avg_starting
"
:
3604
,
"
count_avg_stopped
"
:
3604
,
"
count_avg_stopping
"
:
3604
,
"
count_running
"
:
3604
,
"
count_starting
"
:
3604
,
"
count_stopped
"
:
3604
,
"
count_stopping
"
:
3604
}),
(
'
SELECT mean(avg_stopped) as
"
avg_stopped
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_stopped <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopped
"
:
0.9311386970408875
}),
(
'
SELECT mean(avg_starting) as
"
avg_starting
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_starting <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_starting
"
:
1.4332962039049266
}),
(
'
SELECT mean(avg_running) as
"
avg_running
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_running <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_running
"
:
0.9999273119631822
}),
(
'
SELECT mean(avg_stopping) as
"
avg_stopping
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_stopping <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopping
"
:
1.1135062967253757
}),
(
'
SELECT mean(avg_stopped) as
"
avg_stopped
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE avg_stopped <>0
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
avg_stopped
"
:
0.9311386970408875
})
])
def
test_simulation
(
self
,
run_simulator
,
influx_db
,
query
,
expected_result
):
"""
This is the entry point of the test. This method will be found and executed when the module is ran using pytest
...
...
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