Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ESR compatible with the new ETOS kubernetes controller #67

Merged
merged 24 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
836d02f
Make ESR compatible with the new ETOS kubernetes controller
t-persson Jul 23, 2024
7cffd78
Fix tests and linting
t-persson Jul 23, 2024
38c991e
Review comments
t-persson Jul 23, 2024
42d8707
Fix a problem with the tercc and artifact properties
t-persson Jul 25, 2024
198f926
Don't force the SUITE_RUNNER variable
t-persson Jul 25, 2024
b2e7b07
Call the tercc method
t-persson Jul 25, 2024
59ea504
Use a Suite model instead
t-persson Jul 25, 2024
c8ed4c8
Change from URL to URI
t-persson Jul 26, 2024
44f8a57
Testrun schema from etos library
t-persson Jul 26, 2024
88781f4
Add dataset
t-persson Jul 26, 2024
cdf86e0
Delete commented code
t-persson Jul 26, 2024
375490f
Log listener to read IDENTIFIER environment variable if it exists
t-persson Jul 29, 2024
ad03e4a
Send TERCC event if necessary
t-persson Aug 1, 2024
2c32cb5
Don't pass suite ID to environment provider
t-persson Aug 13, 2024
27a9a2a
Delete environment when running with controller
t-persson Aug 15, 2024
8698276
Write result to termination log
t-persson Aug 26, 2024
28ca23e
Make ESR work even if opentelemetry is not enabled
t-persson Oct 10, 2024
88d67f3
Update to the merged version of etos lib
t-persson Oct 17, 2024
1bdea85
Fix a bug where the RabbitMQ subscriber would reconnect
t-persson Oct 25, 2024
a992131
Send shutdown when finished
t-persson Oct 31, 2024
e210d6e
Fixes so that tox passes
t-persson Nov 21, 2024
65b6c88
Review comment fixes
t-persson Nov 21, 2024
c8db205
Fix the tests and some pylint fixes
t-persson Nov 22, 2024
b32ab30
And fix tests for log listener
t-persson Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions projects/etos_suite_runner/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ requires-python = ">=3.9"
dependencies = [
"packageurl-python~=0.11",
"cryptography>=42.0.4,<43.0.0",
"etos_lib==4.3.6",
"etos_environment_provider==5.1.1",
"etos_lib==4.4.2",
"etos_environment_provider==5.2.1",
"opentelemetry-api~=1.21",
"opentelemetry-exporter-otlp~=1.21",
"opentelemetry-sdk~=1.21",
Expand Down Expand Up @@ -53,4 +53,4 @@ testpaths = ["tests"]
root = "../.."

[tool.setuptools.packages]
find = { where = ["src"], exclude = ["tests"] }
find = { where = ["src"], exclude = ["tests"] }
43 changes: 40 additions & 3 deletions projects/etos_suite_runner/src/etos_suite_runner/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
# limitations under the License.
# -*- coding: utf-8 -*-
"""ETOS suite runner module."""
import os
import json
import logging
import traceback

from etos_lib import ETOS

from .esr import ESR


Expand All @@ -27,17 +31,50 @@

def main():
"""Entry point allowing external calls."""
esr = ESR()
etos = ETOS("ETOS Suite Runner", os.getenv("SOURCE_HOST"), "ETOS Suite Runner")
etos.config.set("results", [])
esr = ESR(etos)
try:
esr.run() # Blocking
results = etos.config.get("results") or []
result = None
for suite_result in results:
andmat900 marked this conversation as resolved.
Show resolved Hide resolved
if suite_result.get("verdict") == "FAILED":
result = suite_result
# If the verdict on any main suite is FAILED, that is the verdict we set on the
# test run, which means that we can break the loop early in that case.
break
if suite_result.get("verdict") == "INCONCLUSIVE":
result = suite_result
if len(results) == 0:
result = {
"conclusion": "Inconclusive",
andmat900 marked this conversation as resolved.
Show resolved Hide resolved
"verdict": "Inconclusive",
"description": "Got no results from ESR",
}
elif result is None:
# No suite failed, so lets just pick the first result
result = results[0]
# Convert, for example, INCONCLUSIVE to Inconclusive to match the controller result struct
# TODO Move the result struct to ETOS library and do this conversion on creation
result["conclusion"] = result["conclusion"].title().replace("_", "")
result["verdict"] = result["verdict"].title()
with open("/dev/termination-log", "w", encoding="utf-8") as termination_log:
json.dump(result, termination_log)
LOGGER.info("ESR result: %r", result)
except:
result = {
"conclusion": "Failed",
"verdict": "Inconclusive",
"description": traceback.format_exc(),
}
with open("/dev/termination-log", "w", encoding="utf-8") as termination_log:
termination_log.write(traceback.format_exc())
json.dump(result, termination_log)
raise
finally:
esr.etos.publisher.wait_for_unpublished_events()
esr.etos.publisher.stop()
LOGGER.info("ESR Finished Executing.", extra={"user_log": True})
LOGGER.info("ESR Finished Executing.")


def run():
Expand Down
Loading
Loading