Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
TFS
controller
Commits
1836983f
Commit
1836983f
authored
7 months ago
by
Waleed Akbar
Browse files
Options
Downloads
Patches
Plain Diff
Changes in Analytics and KpiValueApi test files.
parent
ced97fbb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!294
Release TeraFlowSDN 4.0
,
!266
Resolve: "Unable to correctly extract the aggregation function names from the dictionary received as parameters in the Analyzer message"
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/analytics/backend/tests/test_backend.py
+26
-4
26 additions, 4 deletions
src/analytics/backend/tests/test_backend.py
src/kpi_value_api/tests/test_kpi_value_api.py
+11
-4
11 additions, 4 deletions
src/kpi_value_api/tests/test_kpi_value_api.py
with
37 additions
and
8 deletions
src/analytics/backend/tests/test_backend.py
+
26
−
4
View file @
1836983f
...
...
@@ -15,7 +15,7 @@
import
time
,
json
from
typing
import
Dict
import
logging
import
t
hread
ing
from
threading
import
Event
,
T
hread
from
common.tools.kafka.Variables
import
KafkaTopic
from
analytics.backend.service.AnalyticsBackendService
import
AnalyticsBackendService
from
analytics.backend.tests.messages
import
get_kpi_id_list
,
get_operation_list
,
get_threshold_dict
...
...
@@ -69,9 +69,31 @@ def test_StopRequestListener():
time
.
sleep
(
10
)
LOGGER
.
info
(
'
Initiating StopRequestListener...
'
)
AnalyticsBackendServiceObj
=
AnalyticsBackendService
()
response
=
AnalyticsBackendServiceObj
.
StopRequestListener
(
response_thread
)
LOGGER
.
debug
(
str
(
response
))
assert
isinstance
(
response
,
bool
)
AnalyticsBackendServiceObj
.
stop_event
=
Event
()
listener_thread
=
Thread
(
target
=
AnalyticsBackendServiceObj
.
RequestListener
,
args
=
())
listener_thread
.
start
()
time
.
sleep
(
2000
)
# AnalyticsBackendServiceObj.stop_event.set()
# LOGGER.info('Backend termination initiated. waiting for termination... 10 seconds')
# listener_thread.join(timeout=10)
# assert not listener_thread.is_alive(), "RequestListener thread did not terminate as expected."
LOGGER
.
info
(
'
Completed test_RunRequestListener
'
)
# To test START and STOP communication together
# def test_StopRequestListener():
# LOGGER.info('test_RunRequestListener')
# LOGGER.info('Initiating StartRequestListener...')
# AnalyticsBackendServiceObj = AnalyticsBackendService()
# response_thread = AnalyticsBackendServiceObj.StartRequestListener() # response is Tuple (thread, stop_event)
# # LOGGER.debug(str(response_thread))
# time.sleep(10)
# LOGGER.info('Initiating StopRequestListener...')
# AnalyticsBackendServiceObj = AnalyticsBackendService()
# response = AnalyticsBackendServiceObj.StopRequestListener(response_thread)
# LOGGER.debug(str(response))
# assert isinstance(response, bool)
# To independently tests the SparkListener functionality
# def test_SparkListener():
...
...
This diff is collapsed.
Click to expand it.
src/kpi_value_api/tests/test_kpi_value_api.py
+
11
−
4
View file @
1836983f
...
...
@@ -78,7 +78,14 @@ def test_validate_kafka_topics():
response
=
KafkaTopic
.
create_all_topics
()
assert
isinstance
(
response
,
bool
)
def
test_store_kpi_values
(
kpi_value_api_client
):
LOGGER
.
debug
(
"
>>> test_set_list_of_KPIs: START <<<
"
)
response
=
kpi_value_api_client
.
StoreKpiValues
(
create_kpi_value_list
())
assert
isinstance
(
response
,
Empty
)
def
test_GetKpiAlarms
(
kpi_value_api_client
):
LOGGER
.
debug
(
"
>>> test_GetKpiAlarms
"
)
stream
=
kpi_value_api_client
.
GetKpiAlarms
(
create_kpi_id_request
())
for
response
in
stream
:
LOGGER
.
debug
(
str
(
response
))
assert
isinstance
(
response
,
KpiAlarms
)
# def test_store_kpi_values(kpi_value_api_client):
# LOGGER.debug(" >>> test_set_list_of_KPIs: START <<< ")
# response = kpi_value_api_client.StoreKpiValues(create_kpi_value_list())
# assert isinstance(response, Empty)
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