holado 0.8.4__py3-none-any.whl → 0.9.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of holado might be problematic. Click here for more details.
- holado/common/context/session_context.py +6 -5
- {holado-0.8.4.dist-info → holado-0.9.1.dist-info}/METADATA +1 -1
- {holado-0.8.4.dist-info → holado-0.9.1.dist-info}/RECORD +56 -41
- holado_core/common/block/base.py +3 -3
- holado_core/common/resource/persisted_data_manager.py +10 -10
- holado_core/common/resource/resource_manager.py +34 -37
- holado_core/common/resource/table_data_manager.py +110 -0
- holado_core/common/tools/path_manager.py +31 -6
- holado_django/server/django_projects/rest_api/rest_api/urls.py +1 -1
- holado_docker/tests/behave/steps/tools/docker_controller/client_steps.py +2 -2
- holado_docker/tools/docker_controller/client/rest/docker_controller_client.py +38 -1
- holado_docker/tools/docker_controller/server/run_docker_controller_in_docker.sh +3 -3
- holado_examples/tests/behave/testing_solution/environment.py +3 -3
- holado_examples/tests/behave/testing_solution/src/context/session_context.py +2 -2
- holado_examples/tests/behave/testing_solution/steps/config_steps.py +1 -1
- holado_multitask/multithreading/loopthread.py +4 -4
- holado_python/common/tools/datetime.py +37 -16
- holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +16 -16
- holado_python/standard_library/ssl/resources/certificates/tcpbin.key +26 -26
- holado_python/tests/behave/steps/standard_library/datetime_steps.py +2 -2
- holado_rabbitmq/tools/rabbitmq/rabbitmq_manager.py +3 -3
- holado_report/__init__.py +1 -0
- holado_report/campaign/campaign_manager.py +194 -0
- holado_report/report/builders/detailed_scenario_failed_report_builder.py +11 -7
- holado_report/report/builders/failure_report_builder.py +4 -3
- holado_report/report/builders/short_scenario_failed_report_builder.py +6 -5
- holado_report/report/builders/summary_report_builder.py +1 -1
- holado_report/report/builders/summary_scenario_failed_report_builder.py +6 -5
- holado_report/report/builders/summary_scenario_report_builder.py +12 -11
- holado_report/report/execution_historic.py +4 -2
- holado_report/report/report_manager.py +65 -13
- holado_rest/api/rest/rest_client.py +5 -1
- holado_system/system/filesystem/file.py +5 -2
- holado_test/__init__.py +3 -0
- holado_test/common/context/feature_context.py +3 -3
- holado_test/common/context/scenario_context.py +3 -3
- holado_test/common/context/step_context.py +3 -3
- holado_test/test_server/client/rest/test_server_client.py +117 -0
- holado_test/test_server/server/Dockerfile +70 -0
- holado_test/test_server/server/core/server_context.py +42 -0
- holado_test/test_server/server/core/server_manager.py +54 -0
- holado_test/test_server/server/requirements.txt +2 -0
- holado_test/test_server/server/rest/README +2 -0
- holado_test/test_server/server/rest/api/__init__.py +23 -0
- holado_docker/tools/docker_controller/docker_controller_manager.py → holado_test/test_server/server/rest/api/campaign/__init__.py +10 -28
- holado_test/test_server/server/rest/api/campaign/scenario.py +33 -0
- holado_test/test_server/server/rest/initialize_holado.py +72 -0
- holado_test/test_server/server/rest/logging.conf +50 -0
- holado_test/test_server/server/rest/openapi.yaml +46 -0
- holado_test/test_server/server/rest/run.py +40 -0
- holado_test/test_server/server/run_test_server_in_docker.sh +101 -0
- holado_value/common/tools/unique_value_manager.py +2 -1
- test_holado/environment.py +1 -1
- test_holado/logging.conf +1 -0
- {holado-0.8.4.dist-info → holado-0.9.1.dist-info}/WHEEL +0 -0
- {holado-0.8.4.dist-info → holado-0.9.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
from builtins import super
|
|
15
15
|
from holado.common.context.context import Context
|
|
16
16
|
import logging
|
|
17
|
-
from datetime import
|
|
17
|
+
from holado_python.common.tools.datetime import DateTime
|
|
18
18
|
|
|
19
19
|
logger = logging.getLogger(__name__)
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ class StepContext(Context):
|
|
|
26
26
|
self.__step = step
|
|
27
27
|
self.__status = None
|
|
28
28
|
|
|
29
|
-
self.__start_date =
|
|
29
|
+
self.__start_date = DateTime.now()
|
|
30
30
|
self.__end_date = None
|
|
31
31
|
|
|
32
32
|
def __str__(self):
|
|
@@ -60,7 +60,7 @@ class StepContext(Context):
|
|
|
60
60
|
return None
|
|
61
61
|
|
|
62
62
|
def end(self):
|
|
63
|
-
self.__end_date =
|
|
63
|
+
self.__end_date = DateTime.now()
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
import logging
|
|
15
|
+
from holado_rest.api.rest.rest_client import RestClient
|
|
16
|
+
import socket
|
|
17
|
+
import urllib.parse
|
|
18
|
+
import re
|
|
19
|
+
from holado_rest.api.rest.rest_manager import RestManager
|
|
20
|
+
from holado.common.handlers.undefined import undefined_argument, undefined_value
|
|
21
|
+
import os
|
|
22
|
+
from holado_core.common.tools.converters.converter import Converter
|
|
23
|
+
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TestServerClient(RestClient):
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def new_client(cls, use_localhost=undefined_argument, **kwargs):
|
|
31
|
+
if 'name' not in kwargs:
|
|
32
|
+
kwargs['name'] = None
|
|
33
|
+
if 'url' not in kwargs:
|
|
34
|
+
if use_localhost is undefined_argument:
|
|
35
|
+
env_use = os.getenv("HOLADO_USE_LOCALHOST", False)
|
|
36
|
+
use_localhost = Converter.is_boolean(env_use) and Converter.to_boolean(env_use)
|
|
37
|
+
|
|
38
|
+
url = os.getenv("HOLADO_TEST_SERVER_URL", undefined_value)
|
|
39
|
+
if url is undefined_value:
|
|
40
|
+
scheme = kwargs.get('scheme', undefined_value)
|
|
41
|
+
if scheme is undefined_value:
|
|
42
|
+
scheme = os.getenv("HOLADO_TEST_SERVER_SCHEME", "http")
|
|
43
|
+
host = kwargs.get('host', undefined_value)
|
|
44
|
+
if host is undefined_value:
|
|
45
|
+
host = "localhost" if use_localhost else os.getenv("HOLADO_TEST_SERVER_HOST", "holado_test_server")
|
|
46
|
+
port = kwargs.get('port', undefined_value)
|
|
47
|
+
if port is undefined_value:
|
|
48
|
+
port = os.getenv("HOLADO_TEST_SERVER_PORT", 51232)
|
|
49
|
+
|
|
50
|
+
if port is None:
|
|
51
|
+
url = f"{scheme}://{host}"
|
|
52
|
+
else:
|
|
53
|
+
url = f"{scheme}://{host}:{port}"
|
|
54
|
+
kwargs['url'] = url
|
|
55
|
+
|
|
56
|
+
manager = RestManager(default_client_class=cls)
|
|
57
|
+
res = manager.new_client(**kwargs)
|
|
58
|
+
|
|
59
|
+
return res
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def __init__(self, name, url, headers=None):
|
|
63
|
+
super().__init__(name, url, headers)
|
|
64
|
+
|
|
65
|
+
self.__is_available = None
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def is_available(self):
|
|
69
|
+
if self.__is_available is None:
|
|
70
|
+
self.__is_available = self.ping()
|
|
71
|
+
logger.info(f"Test server is {'not ' if not self.__is_available else ''}available")
|
|
72
|
+
return self.__is_available
|
|
73
|
+
|
|
74
|
+
def ping(self):
|
|
75
|
+
url_parsed = urllib.parse.urlparse(self.url)
|
|
76
|
+
netloc_pattern = r"(?P<host>.*?)(?::(?P<port>\d+))?$"
|
|
77
|
+
m = re.match(netloc_pattern, url_parsed.netloc)
|
|
78
|
+
host = m.group('host')
|
|
79
|
+
port = Converter.to_integer(m.group('port'))
|
|
80
|
+
|
|
81
|
+
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
82
|
+
sock.settimeout(1)
|
|
83
|
+
try:
|
|
84
|
+
sock.connect((host,port))
|
|
85
|
+
except Exception as exc:
|
|
86
|
+
logger.debug(f"Ping of test server failed for ({host}, {port}): {str(exc)}")
|
|
87
|
+
return False
|
|
88
|
+
else:
|
|
89
|
+
sock.close()
|
|
90
|
+
logger.debug(f"Ping of test server succeeded")
|
|
91
|
+
return True
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Manage campaigns actions
|
|
95
|
+
|
|
96
|
+
def update_stored_campaigns(self):
|
|
97
|
+
response = self.put(f"campaign/update")
|
|
98
|
+
return self.response_result(response, status_ok=[200, 204])
|
|
99
|
+
|
|
100
|
+
def get_scenario_history(self, scenario_name=None, size=None):
|
|
101
|
+
data = {}
|
|
102
|
+
if scenario_name is not None:
|
|
103
|
+
data['scenario_name'] = scenario_name
|
|
104
|
+
if size is not None:
|
|
105
|
+
data['size'] = size
|
|
106
|
+
|
|
107
|
+
if data:
|
|
108
|
+
response = self.get(f"campaign/scenario/history", json=data)
|
|
109
|
+
else:
|
|
110
|
+
response = self.get(f"campaign/scenario/history", json=data)
|
|
111
|
+
|
|
112
|
+
return self.response_result(response, status_ok=[200, 204])
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
### Build
|
|
2
|
+
|
|
3
|
+
#FROM python:3.12.9-alpine3.21 AS build
|
|
4
|
+
FROM python:3.12.11-alpine3.22 AS build
|
|
5
|
+
|
|
6
|
+
# Install to build python requirements
|
|
7
|
+
RUN apk update \
|
|
8
|
+
&& apk --no-cache --update add build-base \
|
|
9
|
+
&& apk --update add alpine-sdk \
|
|
10
|
+
&& apk add libffi-dev \
|
|
11
|
+
&& apk add postgresql-dev gcc python3-dev musl-dev \
|
|
12
|
+
&& apk add protobuf-dev
|
|
13
|
+
|
|
14
|
+
# Add tools
|
|
15
|
+
RUN apk --no-cache add bash \
|
|
16
|
+
&& apk --no-cache add nano \
|
|
17
|
+
&& apk --no-cache add curl
|
|
18
|
+
|
|
19
|
+
# Create user
|
|
20
|
+
RUN addgroup appuser \
|
|
21
|
+
&& adduser -G appuser -s /bin/bash -D appuser
|
|
22
|
+
|
|
23
|
+
# Create /code folder
|
|
24
|
+
RUN mkdir /code \
|
|
25
|
+
&& chown -R appuser:appuser /code
|
|
26
|
+
|
|
27
|
+
# Switch to user appuser
|
|
28
|
+
USER appuser
|
|
29
|
+
|
|
30
|
+
# Create python venv and install requirements
|
|
31
|
+
COPY --chown=appuser ./requirements.txt /code/test_server/requirements.txt
|
|
32
|
+
WORKDIR /code/test_server
|
|
33
|
+
RUN python -m venv /code/env \
|
|
34
|
+
&& source /code/env/bin/activate \
|
|
35
|
+
&& pip install -r requirements.txt
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Runtime
|
|
40
|
+
|
|
41
|
+
#FROM python:3.12.9-alpine3.21 AS runtime
|
|
42
|
+
FROM python:3.12.11-alpine3.22 AS runtime
|
|
43
|
+
|
|
44
|
+
# Install for python requirements
|
|
45
|
+
#RUN apk update \
|
|
46
|
+
# && apk --no-cache add libstdc++ \
|
|
47
|
+
# && apk --no-cache add postgresql-dev gcc python3-dev musl-dev
|
|
48
|
+
|
|
49
|
+
# Add tools
|
|
50
|
+
RUN apk --no-cache add bash \
|
|
51
|
+
&& apk --no-cache add nano \
|
|
52
|
+
&& apk --no-cache add curl
|
|
53
|
+
|
|
54
|
+
# Create and switch to user appuser as in build
|
|
55
|
+
RUN addgroup appuser \
|
|
56
|
+
&& adduser -G appuser -s /bin/bash -D appuser
|
|
57
|
+
USER appuser
|
|
58
|
+
|
|
59
|
+
# Copy /code from build
|
|
60
|
+
COPY --chown=appuser --from=build /code /code
|
|
61
|
+
|
|
62
|
+
# Copy docker controller sources
|
|
63
|
+
COPY --chown=appuser ./rest /code/test_server
|
|
64
|
+
|
|
65
|
+
# Activate permanently python venv
|
|
66
|
+
ENV PATH=/code/env/bin:$PATH
|
|
67
|
+
|
|
68
|
+
WORKDIR /code/test_server
|
|
69
|
+
CMD ["sh", "-c", "uvicorn run:app --host 0.0.0.0 --port $HOLADO_TEST_SERVER_PORT"]
|
|
70
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from builtins import super
|
|
2
|
+
from holado.common.context.session_context import SessionContext
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestServerSessionContext(SessionContext):
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super().__init__("TestServerSession")
|
|
12
|
+
|
|
13
|
+
def configure(self, session_kwargs=None):
|
|
14
|
+
logger.info("Configuring TestServerSessionContext")
|
|
15
|
+
|
|
16
|
+
super().configure(session_kwargs)
|
|
17
|
+
|
|
18
|
+
# Override default registered modules
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Register new modules
|
|
23
|
+
|
|
24
|
+
from holado_test.test_server.server.core.server_manager import TestServerManager
|
|
25
|
+
self.services.register_service_type("server_manager", TestServerManager,
|
|
26
|
+
lambda m: m.initialize(self.resource_manager) )
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def initialize(self, session_kwargs=None):
|
|
31
|
+
if session_kwargs is None:
|
|
32
|
+
session_kwargs = {}
|
|
33
|
+
# raise_if_not_exist = session_kwargs.get("raise_if_not_exist", True)
|
|
34
|
+
# do_import = session_kwargs.get("import_compiled_proto", True)
|
|
35
|
+
|
|
36
|
+
# Call default initialization
|
|
37
|
+
super().initialize(session_kwargs)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
from behave.model_core import Status
|
|
16
|
+
from holado_core.common.tools.tools import Tools
|
|
17
|
+
import logging
|
|
18
|
+
# from holado_report.report.builders.json_execution_historic_report_builder import JsonExecutionHistoricReportBuilder
|
|
19
|
+
from holado_report.report.builders.detailed_scenario_failed_report_builder import DetailedScenarioFailedReportBuilder
|
|
20
|
+
from holado_report.report.builders.summary_report_builder import SummaryReportBuilder
|
|
21
|
+
from holado_report.report.builders.summary_scenario_failed_report_builder import SummaryScenarioFailedReportBuilder
|
|
22
|
+
from holado_report.report.builders.short_scenario_failed_report_builder import ShortScenarioFailedReportBuilder
|
|
23
|
+
from holado_report.report.reports.base_report import BaseReport
|
|
24
|
+
from holado_scripting.common.tools.evaluate_parameters import EvaluateParameters
|
|
25
|
+
from holado_report.report.builders.summary_scenario_report_builder import SummaryScenarioReportBuilder
|
|
26
|
+
from holado_report.report.builders.failure_report_builder import FailureReportBuilder
|
|
27
|
+
from holado_report.campaign.campaign_manager import CampaignManager
|
|
28
|
+
# from holado_core.scenario.scenario_duration_manager import ScenarioDurationManager
|
|
29
|
+
|
|
30
|
+
logger = logging.getLogger(__name__)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class TestServerManager(object):
|
|
36
|
+
""" Manage test server
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def __init__(self):
|
|
40
|
+
super().__init__()
|
|
41
|
+
|
|
42
|
+
self.__campaign_manager = CampaignManager(db_name="server/campaigns")
|
|
43
|
+
|
|
44
|
+
def initialize(self, resource_manager):
|
|
45
|
+
self.__campaign_manager.initialize(resource_manager)
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def campaign_manager(self):
|
|
49
|
+
return self.__campaign_manager
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#################################################
|
|
2
|
+
# HolAdo (Holistic Automation do)
|
|
3
|
+
#
|
|
4
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
11
|
+
#################################################
|
|
12
|
+
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
import logging
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _get_session_context():
|
|
22
|
+
return SessionContext.instance()
|
|
23
|
+
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
#################################################
|
|
3
2
|
# HolAdo (Holistic Automation do)
|
|
4
3
|
#
|
|
@@ -11,36 +10,19 @@
|
|
|
11
10
|
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
11
|
#################################################
|
|
13
12
|
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
14
15
|
import logging
|
|
15
|
-
from holado_core.common.tools.converters.converter import Converter
|
|
16
|
-
import os
|
|
17
|
-
from holado_docker.tools.docker_controller.client.rest.docker_controller_client import DockerControllerClient
|
|
18
|
-
from holado_rest.api.rest.rest_manager import RestManager
|
|
19
|
-
from holado.common.handlers.undefined import undefined_argument
|
|
20
16
|
|
|
21
17
|
logger = logging.getLogger(__name__)
|
|
22
18
|
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
def _get_session_context():
|
|
21
|
+
return SessionContext.instance()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class UpdateView(MethodView):
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
kwargs['name'] = None
|
|
30
|
-
if 'url' not in kwargs:
|
|
31
|
-
if use_localhost is undefined_argument:
|
|
32
|
-
env_use = os.getenv("HOLADO_USE_LOCALHOST", False)
|
|
33
|
-
use_localhost = Converter.is_boolean(env_use) and Converter.to_boolean(env_use)
|
|
34
|
-
|
|
35
|
-
host = "localhost" if use_localhost else os.getenv("HOLADO_DOCKER_CONTROLLER_NAME", "holado_docker_controller")
|
|
36
|
-
port = os.getenv("HOLADO_DOCKER_CONTROLLER_PORT", 8000)
|
|
37
|
-
kwargs['url'] = f"http://{host}:{port}"
|
|
38
|
-
|
|
39
|
-
manager = RestManager(default_client_class=DockerControllerClient)
|
|
40
|
-
res = manager.new_client(**kwargs)
|
|
41
|
-
|
|
42
|
-
return res
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
def put(self):
|
|
27
|
+
_get_session_context().server_manager.campaign_manager.update_stored_campaigns()
|
|
28
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#################################################
|
|
2
|
+
# HolAdo (Holistic Automation do)
|
|
3
|
+
#
|
|
4
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
11
|
+
#################################################
|
|
12
|
+
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_session_context():
|
|
18
|
+
return SessionContext.instance()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class HistoryView(MethodView):
|
|
22
|
+
|
|
23
|
+
def get(self, body: dict):
|
|
24
|
+
scenario_name = body.get('scenario_name') if body else None
|
|
25
|
+
size = body.get('size') if body else None
|
|
26
|
+
|
|
27
|
+
res = _get_session_context().server_manager.campaign_manager.get_scenario_history(scenario_name=scenario_name, size=size)
|
|
28
|
+
return res
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
#################################################
|
|
16
|
+
# GOAL: Tools when using a clone of HolAdo project.
|
|
17
|
+
#
|
|
18
|
+
# This file contains methods usefull to initialize environments using a clone of HolAdo project.
|
|
19
|
+
#
|
|
20
|
+
# USAGE:
|
|
21
|
+
# - Copy this file in projects using HolAdo.
|
|
22
|
+
# - Define environment variable HOLADO_PATH with path to cloned HolAdo project.
|
|
23
|
+
# If HOLADO_PATH is defined, sources of cloned HolAdo project are used, else installed holado package is used.
|
|
24
|
+
#################################################
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
import os
|
|
29
|
+
import sys
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def insert_sys_path(path, index=0):
|
|
33
|
+
"""Insert a path in sys.path if it doesn't already exists.
|
|
34
|
+
"""
|
|
35
|
+
if path not in sys.path:
|
|
36
|
+
sys.path.insert(index, path)
|
|
37
|
+
|
|
38
|
+
def insert_sys_paths(list_paths, index=0):
|
|
39
|
+
"""Insert a list of path in sys.path if it doesn't already exists.
|
|
40
|
+
"""
|
|
41
|
+
if list_paths:
|
|
42
|
+
for path in list_paths:
|
|
43
|
+
insert_sys_path(path, index=index)
|
|
44
|
+
|
|
45
|
+
def insert_holado_source_paths(with_test_behave=True):
|
|
46
|
+
"""Insert in sys.path all HolAdo source paths.
|
|
47
|
+
If environment variable HOLADO_PATH is defined with path to HolAdo project, following paths are inserted in sys.path:
|
|
48
|
+
- HOLADO_PATH/src: path to holado modules sources
|
|
49
|
+
- HOLADO_PATH/tests/behave (if with_test_behave==True): path to holado test sources, needed by testing solutions
|
|
50
|
+
"""
|
|
51
|
+
holado_path = os.getenv('HOLADO_PATH')
|
|
52
|
+
if holado_path is None:
|
|
53
|
+
try:
|
|
54
|
+
import holado # @UnusedImport
|
|
55
|
+
except Exception as exc:
|
|
56
|
+
if "No module named" in str(exc):
|
|
57
|
+
raise Exception(f"If environment variable HOLADO_PATH is not defined with path to HolAdo project, 'holado' python package must be installed")
|
|
58
|
+
else:
|
|
59
|
+
raise exc
|
|
60
|
+
else:
|
|
61
|
+
# holado is installed, and all sources are already accessible
|
|
62
|
+
pass
|
|
63
|
+
else:
|
|
64
|
+
print(f"Using HolAdo project installed in '{holado_path}'")
|
|
65
|
+
# import traceback
|
|
66
|
+
# print("".join(traceback.format_list(traceback.extract_stack())))
|
|
67
|
+
# insert_sys_path(holado_path)
|
|
68
|
+
insert_sys_path(os.path.join(holado_path, "src"))
|
|
69
|
+
if with_test_behave:
|
|
70
|
+
insert_sys_path(os.path.join(holado_path, "tests", "behave"))
|
|
71
|
+
|
|
72
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[holado]
|
|
2
|
+
level=INFO
|
|
3
|
+
#level=DEBUG
|
|
4
|
+
#level=TRACE
|
|
5
|
+
log_on_console=False
|
|
6
|
+
#log_on_console=True
|
|
7
|
+
log_in_file=True
|
|
8
|
+
#log_in_file=False
|
|
9
|
+
|
|
10
|
+
[loggers_levels]
|
|
11
|
+
holado=INFO
|
|
12
|
+
#holado=DEBUG
|
|
13
|
+
#holado.common.context=INFO
|
|
14
|
+
#holado.common.context.session_context=DEBUG
|
|
15
|
+
holado_core.common.block.scope_manager=INFO
|
|
16
|
+
#holado_core.common.handlers=TRACE
|
|
17
|
+
#holado_core.common.tools=DEBUG
|
|
18
|
+
holado_core.common.tools.comparators=INFO
|
|
19
|
+
#holado_core.common.tools.tools=TRACE
|
|
20
|
+
holado_db.tools=DEBUG
|
|
21
|
+
holado_logging=INFO
|
|
22
|
+
holado_multitask=WARNING
|
|
23
|
+
#holado_multitask.multitasking.multitask_manager=TRACE
|
|
24
|
+
#holado_protobuf.ipc.protobuf=DEBUG
|
|
25
|
+
#holado_protobuf.ipc.protobuf.protobuf_messages=TRACE
|
|
26
|
+
#holado_python.standard_library.socket=DEBUG
|
|
27
|
+
#holado_rest.api/rest=DEBUG
|
|
28
|
+
#holado_value.common.tables.value_table_cell=TRACE
|
|
29
|
+
holado_s3.tools.s3.minio_client.trace=INFO
|
|
30
|
+
|
|
31
|
+
#holado_scripting.common.tools=DEBUG
|
|
32
|
+
#holado_scripting.common.tools.expression_evaluator=DEBUG
|
|
33
|
+
#holado_scripting.common.tools.expression_evaluator=TRACE
|
|
34
|
+
#holado_scripting.common.tools.variable_manager=TRACE
|
|
35
|
+
#holado_scripting.text.interpreter=TRACE
|
|
36
|
+
|
|
37
|
+
#holado_system=DEBUG
|
|
38
|
+
#holado_test.behave.behave=DEBUG
|
|
39
|
+
#holado_yaml=DEBUG
|
|
40
|
+
|
|
41
|
+
# External libraries
|
|
42
|
+
chardet=WARNING
|
|
43
|
+
pika=WARNING
|
|
44
|
+
psycopg=INFO
|
|
45
|
+
ssl=DEBUG
|
|
46
|
+
suds.transport=DEBUG
|
|
47
|
+
subprocess=DEBUG
|
|
48
|
+
urllib3=INFO
|
|
49
|
+
zeep.transports=DEBUG
|
|
50
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
openapi: "3.0.0"
|
|
2
|
+
info:
|
|
3
|
+
version: "1"
|
|
4
|
+
title: "Test Server API"
|
|
5
|
+
description: |
|
|
6
|
+
API exposed by Test Server.
|
|
7
|
+
paths:
|
|
8
|
+
/campaign/update:
|
|
9
|
+
put:
|
|
10
|
+
description: "Update stored campaigns"
|
|
11
|
+
responses:
|
|
12
|
+
200:
|
|
13
|
+
description: ""
|
|
14
|
+
content:
|
|
15
|
+
application/json:
|
|
16
|
+
schema:
|
|
17
|
+
type: "string"
|
|
18
|
+
|
|
19
|
+
/campaign/scenario/history:
|
|
20
|
+
get:
|
|
21
|
+
description: "Get execution history of a scenario"
|
|
22
|
+
requestBody:
|
|
23
|
+
content:
|
|
24
|
+
application/json:
|
|
25
|
+
schema:
|
|
26
|
+
type: "object"
|
|
27
|
+
nullable: true
|
|
28
|
+
properties:
|
|
29
|
+
scenario_name:
|
|
30
|
+
type: string
|
|
31
|
+
size:
|
|
32
|
+
type: integer
|
|
33
|
+
responses:
|
|
34
|
+
200:
|
|
35
|
+
description: "Execution history of a scenario"
|
|
36
|
+
content:
|
|
37
|
+
application/json:
|
|
38
|
+
schema:
|
|
39
|
+
type: "string"
|
|
40
|
+
|
|
41
|
+
components:
|
|
42
|
+
securitySchemes: {}
|
|
43
|
+
schemas:
|
|
44
|
+
DockerControler:
|
|
45
|
+
properties: {}
|
|
46
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#################################################
|
|
2
|
+
# HolAdo (Holistic Automation do)
|
|
3
|
+
#
|
|
4
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
11
|
+
#################################################
|
|
12
|
+
|
|
13
|
+
import connexion
|
|
14
|
+
from connexion.resolver import MethodViewResolver
|
|
15
|
+
import os
|
|
16
|
+
import logging
|
|
17
|
+
|
|
18
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
19
|
+
|
|
20
|
+
# For debug with HolAdo sources, insert HolAdo source paths
|
|
21
|
+
from initialize_holado import insert_holado_source_paths # @UnresolvedImport
|
|
22
|
+
insert_holado_source_paths(with_test_behave=False)
|
|
23
|
+
|
|
24
|
+
# Initialize HolAdo
|
|
25
|
+
import holado
|
|
26
|
+
from holado_test.test_server.server.core.server_context import TestServerSessionContext
|
|
27
|
+
holado.initialize(TSessionContext=TestServerSessionContext,
|
|
28
|
+
logging_config_file_path=os.path.join(here, 'logging.conf'), log_level=logging.INFO,
|
|
29
|
+
log_on_console=True, log_in_file=False,
|
|
30
|
+
garbage_collector_periodicity=None)
|
|
31
|
+
|
|
32
|
+
# Update stored campaigns
|
|
33
|
+
from holado.common.context.session_context import SessionContext
|
|
34
|
+
SessionContext.instance().server_manager.campaign_manager.update_stored_campaigns()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
app = connexion.FlaskApp(__name__, pythonic_params=True)
|
|
38
|
+
app.add_api('openapi.yaml',
|
|
39
|
+
resolver=MethodViewResolver('api'), resolver_error=501,
|
|
40
|
+
pythonic_params=True)
|