Skip to content
Snippets Groups Projects
testTelemetryBackend.py 1.61 KiB
Newer Older
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Waleed Akbar's avatar
Waleed Akbar committed
import sys
print (sys.path)
sys.path.append('/home/tfs/tfs-ctrl')
from typing import Tuple
from common.proto.context_pb2 import Empty
from src.telemetry.backend.service.TelemetryBackendService import TelemetryBackendService

LOGGER = logging.getLogger(__name__)


###########################
# Tests Implementation of Telemetry Backend
###########################

def test_verify_kafka_topics():
    LOGGER.warning('test_receive_kafka_request requesting')
    TelemetryBackendServiceObj = TelemetryBackendService()
    KafkaTopics = ['topic_request', 'topic_response']
    response = TelemetryBackendServiceObj.create_topic_if_not_exists(KafkaTopics)
    LOGGER.debug(str(response))
    assert isinstance(response, bool)

Waleed Akbar's avatar
Waleed Akbar committed
def test_run_kafka_listener():
    LOGGER.warning('test_receive_kafka_request requesting')
    TelemetryBackendServiceObj = TelemetryBackendService()
    response = TelemetryBackendServiceObj.run_kafka_listener()
    LOGGER.debug(str(response))
Waleed Akbar's avatar
Waleed Akbar committed
    assert isinstance(response, bool)