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
1f080c9d
Commit
1f080c9d
authored
6 years ago
by
Nikolay Stanchev
Browse files
Options
Downloads
Patches
Plain Diff
Updates conftest file of alerts integration test
parent
e74c157c
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
src/test/clmctest/alerts/conftest.py
+35
-1
35 additions, 1 deletion
src/test/clmctest/alerts/conftest.py
with
35 additions
and
1 deletion
src/test/clmctest/alerts/conftest.py
+
35
−
1
View file @
1f080c9d
...
...
@@ -31,9 +31,13 @@ from shutil import rmtree
from
signal
import
SIGKILL
from
json
import
load
from
pkg_resources
import
resource_filename
from
requests
import
delete
,
get
from
clmctest.alerts.alert_handler_server
import
LOG_TEST_FOLDER_PATH
KAPACITOR_PORT
=
9092
@fixture
(
scope
=
"
module
"
)
def
rspec_config
():
"""
...
...
@@ -51,11 +55,23 @@ def rspec_config():
@fixture
(
autouse
=
True
,
scope
=
"
module
"
)
def
set_up_tear_down_fixture
():
def
set_up_tear_down_fixture
(
rspec_config
):
"""
Set up/tear down fixture for the alerts integration test.
"""
global
KAPACITOR_PORT
kapacitor_host
=
None
for
host
in
rspec_config
:
if
host
[
"
name
"
]
==
"
clmc-service
"
:
kapacitor_host
=
host
[
"
ip_address
"
]
break
assert
kapacitor_host
is
not
None
kapacitor_url
=
"
http://{0}:{1}
"
.
format
(
kapacitor_host
,
KAPACITOR_PORT
)
if
exists
(
LOG_TEST_FOLDER_PATH
):
rmtree
(
LOG_TEST_FOLDER_PATH
)
# clean out the log directory
makedirs
(
LOG_TEST_FOLDER_PATH
)
# create the log directory
...
...
@@ -73,3 +89,21 @@ def set_up_tear_down_fixture():
kill
(
process_id
,
SIGKILL
)
if
exists
(
LOG_TEST_FOLDER_PATH
):
rmtree
(
LOG_TEST_FOLDER_PATH
)
print
(
"
Deleting Kapacitor tasks, topics and handlers that were created for this test...
"
)
test_sfc_instance_scope
=
"
CLMCMetrics.MS_I1
"
# get all tasks from kapacitor (that were created in this test) and delete them
kapacitor_tasks
=
get
(
"
{0}/kapacitor/v1/tasks
"
.
format
(
kapacitor_url
)).
json
()[
"
tasks
"
]
kapacitor_task_links
=
[
task
[
"
link
"
][
"
href
"
]
for
task
in
kapacitor_tasks
if
task
[
"
id
"
].
startswith
(
test_sfc_instance_scope
)]
for
task_link
in
kapacitor_task_links
:
delete
(
"
{0}{1}
"
.
format
(
kapacitor_url
,
task_link
))
# get all topics and handlers from kapacitor (that were created in this test) and delete them
kapacitor_topics
=
get
(
"
{0}/kapacitor/v1/alerts/topics
"
.
format
(
kapacitor_url
)).
json
()[
"
topics
"
]
for
topic
in
kapacitor_topics
:
if
topic
[
"
id
"
].
startswith
(
test_sfc_instance_scope
):
topic_handlers
=
get
(
"
{0}{1}
"
.
format
(
kapacitor_url
,
topic
[
"
handlers-link
"
][
"
href
"
])).
json
()[
"
handlers
"
]
for
handler
in
topic_handlers
:
delete
(
"
{0}{1}
"
.
format
(
kapacitor_url
,
handler
[
"
link
"
][
"
href
"
]))
delete
(
"
{0}{1}
"
.
format
(
kapacitor_url
,
topic
[
"
link
"
][
"
href
"
]))
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