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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
b8c9861b
Commit
b8c9861b
authored
Jul 29, 2019
by
Nikolay Stanchev
Browse files
Options
Downloads
Patches
Plain Diff
Test refactoring
parent
9edd5a87
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/clmctest/alerts/test_alerts.py
+35
-35
35 additions, 35 deletions
src/test/clmctest/alerts/test_alerts.py
with
35 additions
and
35 deletions
src/test/clmctest/alerts/test_alerts.py
+
35
−
35
View file @
b8c9861b
...
...
@@ -40,6 +40,39 @@ SFEMC = "flame_sfemc"
sfc
,
sfc_instance
=
"
MS_Template_1
"
,
"
MS_Template_1_1
"
expected_alerts_list
=
[
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
high_requests
"
,
"
task_identifier
"
:
"
46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
handlers
"
:
[
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b/handlers
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_active_requests
"
,
"
task_identifier
"
:
"
7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca/handlers
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_running_processes
"
,
"
task_identifier
"
:
"
f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8/handlers
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
,
"
task_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320/handlers
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
service_started
"
,
"
task_identifier
"
:
"
2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
handlers
"
:
[
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73/handlers
"
}
]
def
is_valid_timestamp
(
str_timestamp
):
try
:
...
...
@@ -157,39 +190,6 @@ class TestAlerts(object):
# check that the alerts can be fetched with a GET request
print
(
"
Validate that the alerts were registered and can be fetched with a GET request.
"
)
expected_alerts_list
=
[
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
high_requests
"
,
"
task_identifier
"
:
"
46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
handlers
"
:
[
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/46fb8800c8a5eeeb04b090d838d475df574a2e6d854b5d678fc981c096eb6c1b/handlers
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_active_requests
"
,
"
task_identifier
"
:
"
7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/7a9867f9270dba6635ac3760a3b70bc929f5bd0f3bf582e45d27fbd437f528ca/handlers
"
},
{
"
policy
"
:
"
scale_nginx_policy
"
,
"
trigger
"
:
"
increase_in_running_processes
"
,
"
task_identifier
"
:
"
f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f5edaeb27fb847116be749c3815d240cbf0d7ba79aee1959daf0b3445a70f2c8/handlers
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
no_measurements
"
,
"
task_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
handlers
"
:
[
SFEMC
,
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/f7dab6fd53001c812d44533d3bbb6ef45f0d1d39b9441bc3c60402ebda85d320/handlers
"
},
{
"
policy
"
:
"
deadman_policy
"
,
"
trigger
"
:
"
service_started
"
,
"
task_identifier
"
:
"
2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
handlers
"
:
[
"
http://172.40.231.200:9999/
"
],
"
topic_identifier
"
:
"
2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
task_api_endpoint
"
:
"
/kapacitor/v1/tasks/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
topic_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73
"
,
"
topic_handlers_api_endpoint
"
:
"
/kapacitor/v1/alerts/topics/2707cb9c0397c1aae0f831d5893aa769c6eaeb8834c974f2c14eb2c60be5bd73/handlers
"
}
]
response
=
get
(
"
http://{0}/clmc-service/alerts/{1}/{2}
"
.
format
(
clmc_service_host
,
sfc
,
sfc_instance
))
assert
response
.
status_code
==
200
,
response
.
text
clmc_service_response
=
response
.
json
()
...
...
@@ -357,7 +357,7 @@ class TestAlerts(object):
# delete the alerts with a DELETE request for the SFC instance
response
=
delete
(
"
http://{0}/clmc-service/alerts/{1}/{2}
"
.
format
(
clmc_service_host
,
sfc
,
sfc_instance
))
assert
response
.
status_code
==
200
,
"
Incorrect status code returned after deleting the alert specification
"
assert
response
.
json
()
==
{
"
deleted_alerts_count
"
:
5
}
assert
response
.
json
()
==
{
"
deleted_alerts_count
"
:
len
(
expected_alerts_list
)
}
# create the alerts again so that they can be deleted with another endpoint
with
open
(
alerts_spec
,
'
rb
'
)
as
alerts
:
...
...
@@ -369,7 +369,7 @@ class TestAlerts(object):
# delete the alerts with a DELETE request for all SFC instances
response
=
delete
(
"
http://{0}/clmc-service/alerts/{1}
"
.
format
(
clmc_service_host
,
sfc
))
assert
response
.
status_code
==
200
,
"
Incorrect status code returned after deleting the alert specification
"
assert
response
.
json
()
==
{
sfc_instance
:
{
"
deleted_alerts_count
"
:
5
}}
assert
response
.
json
()
==
{
sfc_instance
:
{
"
deleted_alerts_count
"
:
len
(
expected_alerts_list
)
}}
def
test_data_deletion
(
rspec_config
):
...
...
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