Skip to content

Commit

Permalink
47-refactor-protocol-verifier-file-structure (#49)
Browse files Browse the repository at this point in the history
* create results folder within protocol verifier

* rename file to avoid confusion with test files

* add a metrics_and_events folder in protocol verifier

* add metrics_and_events within tests folder

* rename test file fo base_test_classes

* create utils folder within protocol verifier

* add testing_suite folder to protocol verifier

* add __init__.py to testing_suite folder

* move end to end curl commands script into scripts folder (#46)

* fix linting

* update cal_pv_finish filename to pv_file_inspector

* update results folder python filenames

* Delete test_harness/log_file_store/error_log_1bf5af4e-bfe0-40ef-831b-05395f020524.txt

* Delete test_harness/log_file_store/error_log_5833cdad-06e9-4834-8fb0-4434186f82aa.txt
  • Loading branch information
AdrianMontaguSmartDCSIT authored May 29, 2024
1 parent 42a52ea commit 3f41fdf
Show file tree
Hide file tree
Showing 28 changed files with 58 additions and 46 deletions.
4 changes: 2 additions & 2 deletions test_harness/protocol_verifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

from test_harness.config.config import TestConfig, HarnessConfig
from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig
from test_harness.protocol_verifier.generate_test_files import (
from test_harness.protocol_verifier.testing_suite.generate_test_files import (
generate_test_events_from_puml_files,
get_test_events_from_test_file_jsons,
)
from test_harness.protocol_verifier.send_job_defs import send_job_defs_from_uml
from test_harness.protocol_verifier.test_utils import (
from test_harness.protocol_verifier.testing_suite.base_test_classes import (
FunctionalTest,
PerformanceTest,
)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import aiokafka

from test_harness.simulator.simulator import ResultsHandler
from test_harness.protocol_verifier.types import ResultsDict
from test_harness.protocol_verifier.utils.types import ResultsDict
from test_harness.metrics.metrics import MetricsRetriever


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
MessageExceptionHandler,
MessageSender,
)
from test_harness.protocol_verifier.types import ERROR_LOG_FILE_PREFIX
from test_harness.protocol_verifier.utils.types import ERROR_LOG_FILE_PREFIX


class ErrorLogger:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig
from aioresponses import aioresponses, CallbackResult
from test_harness.protocol_verifier.utils import PVLogFileNameCallback
from test_harness.protocol_verifier.utils.utils import PVLogFileNameCallback


@contextmanager
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pylint: disable=C0114
import pandas as pd

from .pvresults import PVResults
from .pv_results import PVResults


class PVFunctionalResults(PVResults):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@
AggregationTask,
BinValueCount,
)
from .pvresults import PVResults
from .pvresultsdataframecalculator import (
from .pv_results import PVResults
from .pv_results_dataframe_calculator import (
PVResultsDataFrameCalculatorV2,
PVResultsDataFrameCalculator,
)
from .types import (
from test_harness.protocol_verifier.utils.types import (
AveragesDict,
FailuresDict,
ProcessErrorDataDict,
ReceptionCountsDict,
ResultsDict,
)
from test_harness.results.results import ResultsHolder, DictResultsHolder
from .kafka_metrics import consume_events_from_kafka_topic
from test_harness.protocol_verifier.metrics_and_events.kafka_metrics import (
consume_events_from_kafka_topic
)


class PVPerformanceResults(PVResults):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# pylint: disable=R0914
import warnings

from .pvperformanceresults import (
from .pv_performance_results import (
PVPerformanceResults,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
import scipy.stats as sps
import dask.array as da

from .types import (
from test_harness.protocol_verifier.utils.types import (
AveragesDict,
FailuresDict,
ReceptionCountsDict,
)
from test_harness.results.results import ResultsHolder
from test_harness.protocol_verifier.pvperformanceresults import AggregationTask
from test_harness.protocol_verifier.results.pv_performance_results import (
AggregationTask
)


class PVResultsDataFrameCalculator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import aiokafka

from test_harness.simulator.simulator import QueueHandler, ResultsHandler
from .pvresults import PVResults
from .pvperformanceresults import PVPerformanceResults
from .kafka_metrics import (
from .pv_results import PVResults
from .pv_performance_results import PVPerformanceResults
from test_harness.protocol_verifier.metrics_and_events.kafka_metrics import (
decode_and_yield_events_from_raw_msgs,
decode_and_yield_events_from_raw_msgs_no_length,
)
from .types import PVResultsHandlerItem
from test_harness.protocol_verifier.utils.types import PVResultsHandlerItem


class PVResultsAdder(ResultsHandler):
Expand Down
2 changes: 1 addition & 1 deletion test_harness/protocol_verifier/simulator_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from abc import ABC, abstractmethod

from test_harness.simulator.simulator import SimDatum, Batch, async_do_nothing
from test_harness.protocol_verifier.types import TemplateOptions
from test_harness.protocol_verifier.utils.types import TemplateOptions


class PVSimDatumTransformer(ABC):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
RollOverChoice,
choose_from_front_of_list,
)
from test_harness.protocol_verifier.calc_pv_finish import (
from test_harness.protocol_verifier.pv_file_inspector import (
PVFileInspector,
handle_domain_log_file_reception_and_save,
)
Expand Down Expand Up @@ -67,25 +67,31 @@
AsyncKillManager,
AsyncKillException,
)
from .pvresults import PVResults
from .pvresultshandler import (
from test_harness.protocol_verifier.results.pv_results import PVResults
from test_harness.protocol_verifier.results.pv_results_handler import (
PVResultsHandler,
PVResultsAdder,
PVKafkaMetricsHandler,
PVKafkaMetricsHandlerNoLength,
)
from .pvperformanceresults import PVPerformanceResults
from .kafka_metrics import PVKafkaMetricsRetriever
from .pvresultsdataframe import PVResultsDataFrame
from .pvfunctionalresults import PVFunctionalResults
from .types import (
from test_harness.protocol_verifier.results.pv_performance_results import (
PVPerformanceResults
)
from ..metrics_and_events.kafka_metrics import PVKafkaMetricsRetriever
from test_harness.protocol_verifier.results.pv_results_dataframe import (
PVResultsDataFrame
)
from test_harness.protocol_verifier.results.pv_functional_results import (
PVFunctionalResults
)
from ..utils.types import (
TemplateOptions,
MetricsRetriverKwargsPairAndHandlerKwargsPair,
MetricsRetrieverKwargsPair,
ResultsHandlerKwargsPair,
ERROR_LOG_FILE_PREFIX,
)
from .send_events import (
from ..metrics_and_events.send_events import (
get_message_bus_kwargs,
get_producer_kwargs,
PVMessageSender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json

from test_harness.config.config import TestConfig
from test_harness.protocol_verifier.types import (
from test_harness.protocol_verifier.utils.types import (
TestJobFile, TemplateJobsDataAndValidityTuple,
SequenceTypeData, UpdateableIterator
)
Expand Down
2 changes: 1 addition & 1 deletion test_harness/protocol_verifier/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pygrok import Grok
from typing import Generator, Literal, Callable, Any
from test_harness.simulator.simulator import SimDatum
from test_harness.protocol_verifier.test_utils import (
from test_harness.protocol_verifier.testing_suite.base_test_classes import (
PVPerformanceResults,
PVResultsDataFrame,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import aiokafka

from test_harness.protocol_verifier.kafka_metrics import (
from test_harness.protocol_verifier.metrics_and_events.kafka_metrics import (
decode_and_yield_events_from_raw_msgs_no_length,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from test_harness.utils import check_dict_equivalency
from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig
from test_harness.message_buses.message_buses import get_producer_context
from test_harness.protocol_verifier.send_events import (
from test_harness.protocol_verifier.metrics_and_events.send_events import (
PVInputConverter,
PVResponseConverter,
PVMessageResponseConverter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from aioresponses import aioresponses


from test_harness.protocol_verifier.calc_pv_finish import pv_inspector_io
from test_harness.protocol_verifier.pv_file_inspector import pv_inspector_io


logging.basicConfig(level=logging.INFO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
select_store_paths,
full_pv_test,
)
from test_harness.protocol_verifier.generate_test_files import TestJobFile
from test_harness.protocol_verifier.testing_suite.generate_test_files import (
TestJobFile
)
from test_harness.utils import clean_directories
from test_harness.simulator.simulator_profile import Profile
from test_harness import AsyncTestStopper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
convert_list_dict_to_json_io_bytes,
convert_list_dict_to_pv_json_io_bytes,
)
from test_harness.protocol_verifier.types import TemplateOptions
from test_harness.protocol_verifier.utils.types import TemplateOptions

uuid4hex = re.compile("[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}\\Z", re.I)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@

from test_harness.config.config import TestConfig
from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig
from test_harness.protocol_verifier.generate_test_files import (
from test_harness.protocol_verifier.testing_suite.generate_test_files import (
generate_test_events_from_puml_files,
)
from test_harness.protocol_verifier.pvperformanceresults import (
from test_harness.protocol_verifier.results.pv_performance_results import (
ProcessErrorDataDict,
ResultsDict,
)
from test_harness.protocol_verifier.pvresultsdataframe import (
from test_harness.protocol_verifier.results.pv_results_dataframe import (
PVResultsDataFrame,
)
from test_harness.protocol_verifier.test_utils import (
from test_harness.protocol_verifier.testing_suite.base_test_classes import (
FunctionalTest,
PerformanceTest,
PVFunctionalResults,
PVResultsHandler,
)
from test_harness import TestHarnessPbar
from test_harness.protocol_verifier.types import PVResultsHandlerItem
from test_harness.protocol_verifier.utils.types import PVResultsHandlerItem
from test_harness.simulator.simulator_profile import Profile
from test_harness.utils import (
check_dict_equivalency,
Expand All @@ -62,25 +62,25 @@
)
from test_harness.results.results import DictResultsHolder, ResultsHolder
from test_harness import AsyncTestStopper
from test_harness.protocol_verifier.types import ERROR_LOG_FILE_PREFIX
from test_harness.protocol_verifier.utils.types import ERROR_LOG_FILE_PREFIX

# get test config
test_config_path = os.path.join(
Path(__file__).parent.parent.parent.parent
Path(__file__).parent.parent.parent.parent.parent
/ "tests/test_harness/config/test_config.config",
)

# test files directory path
test_files_path = Path(__file__).parent / "test_files"
test_files_path = Path(__file__).parent.parent / "test_files"

# get path of tests uml file
test_file_path = os.path.join(
Path(__file__).parent / "test_files", "test_uml_job_def.puml"
Path(__file__).parent.parent / "test_files", "test_uml_job_def.puml"
)


# grok file path
grok_file = Path(__file__).parent / "test_files" / "grok_file.txt"
grok_file = Path(__file__).parent.parent / "test_files" / "grok_file.txt"


def check_numpy_expected_vs_actual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from test_harness.protocol_verifier.generate_test_files import (
from test_harness.protocol_verifier.testing_suite.generate_test_files import (
generate_test_events_from_puml_file,
generate_test_events_from_puml_files,
load_test_file_data_json_into_test_file_holder,
Expand All @@ -16,7 +16,7 @@
from test_harness.utils import check_dict_equivalency

# test file resources folder
test_file_resources = Path(__file__).parent / "test_files"
test_file_resources = Path(__file__).parent.parent / "test_files"


def test_generate_test_events_from_puml_file_default_config() -> None:
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 3f41fdf

Please sign in to comment.