Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ bld/
[Oo]bj/
[Ll]og/
dist/
.report.json

!lib-injection/build/docker/ruby/lib_injection_rails_app/bin
!utils/build/docker/ruby/rails52/bin
Expand Down
1 change: 0 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ click,PyPI,BSD-3-Clause,Armin Ronacher
requests,PyPI,Apache-2.0,Kenneth Reitz
Werkzeug,PyPI,BSD-3-Clause,Armin Ronacher
pytest,PyPI,MIT,"Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others"
pytest-json-report,PyPI,MIT,numirias
black,PyPI,MIT,Łukasz Langa
python-dateutil,PyPI,Apache-2.0,Gustavo Niemeyer
packaging,PyPI,Apache-2.0,Donald Stufft and individual contributors
Expand Down
28 changes: 5 additions & 23 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import pytest
from _pytest.junitxml import xml_key
from pluggy._result import _Result as Result
from pytest_jsonreport.plugin import JSONReport

from utils import context
from utils._context.junit_parameters import fingerprint_parameters
Expand All @@ -30,9 +29,6 @@
from utils.manifest import Manifest
from utils.properties_serialization import SetupProperties

# Monkey patch JSON-report plugin to avoid noise in report
JSONReport.pytest_terminal_summary = lambda *args, **kwargs: None # noqa: ARG005

# pytest does not keep a trace of deselected items, so we keep it in a global variable
_deselected_items: list[pytest.Item] = []
setup_properties = SetupProperties()
Expand Down Expand Up @@ -221,7 +217,6 @@ def pytest_configure(config: pytest.Config) -> None:
pytest.exit(f"Scenario {config.option.scenario} does not exist", 1)

if not config.option.replay and not config.option.collectonly:
config.option.json_report_file = f"{context.scenario.host_log_folder}/report.json"
config.option.xmlpath = f"{context.scenario.host_log_folder}/reportJunit.xml"

configure_decorators(config)
Expand Down Expand Up @@ -525,15 +520,17 @@ def pytest_fixture_setup(


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo) -> Generator[None, Result, None]: # noqa: ARG001
def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo) -> Generator[None, Result, None]:
if call.when == "setup":
_collect_item_metadata(item)

# Run all other hooks to get the report object
outcome = yield
rep: pytest.TestReport = outcome.get_result()

if rep.when == "call": # only attach outcome after test call
# rep.outcome is one of: passed, failed, skipped
# but json_report also distinguishes xfailed/xpassed
# via rep.wasxfail and outcome
# xfailed/xpassed are distinguished via rep.wasxfail and outcome
value = rep.outcome
if getattr(rep, "wasxfail", None):
if rep.outcome == "skipped":
Expand All @@ -558,21 +555,6 @@ def _set_outcome_properties(outcome: PytestOutcome, user_properties: list[tuple]
user_properties.append(("dd_tags[test.final_status]", final_status))


@pytest.hookimpl(optionalhook=True)
def pytest_json_runtest_metadata(item: pytest.Item, call: pytest.CallInfo) -> dict | None:
if call.when != "setup":
return {}

return _collect_item_metadata(item)


def pytest_json_modifyreport(json_report: dict) -> None:
# add usefull data for reporting
json_report["context"] = context.serialize()

logger.debug("Modifying JSON report finished")


def pytest_sessionfinish(session: pytest.Session, exitstatus: int) -> None:
logger.info("Executing pytest_sessionfinish")

Expand Down
2 changes: 1 addition & 1 deletion docs/execute/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ System tests export a lot of data in `logs/` folder, and this folder is usually
* `logs/interfaces/agent`: **agent -> bakcend communication, key folder if you own an agent**
* `logs/interfaces.log`: Debug log of what's happening on interfaces
* `logs/pytest.log`: **Entire debug, including `logs/interfaces.log`, lot of infos here**
* `logs/report.json`: Technical data about the test run, will be exported to dashboard
* `logs/reportJunit.xml`: Test results in JUnit format, exported to Test Optimization
* `logs/weblog_image.json`: Result of `docker inspect` on [weblog](../edit/weblog.md) images
2 changes: 1 addition & 1 deletion docs/understand/scenarios/k8s_lib_injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ In the following image you can see the log folder content:
These are the main important log/data files:

* **test.log:** General log generated by system-tests.
* **report.json:** Pytest results report.
* **reportJunit.xml:** Pytest results report in JUnit XML format.
* **lib-injection-testing-xyz-config.yaml:** The kind cluster configuration. In this file you can check the open ports for each cluster and test case.
* **lib-injection-testing-xyz_help_values:** Helm chart operator values for each test case.
* **daemon.set.describe.log:** Datadog Cluster daemon set logs.
Expand Down
1 change: 0 additions & 1 deletion docs/understand/scenarios/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,6 @@ These are the main important log/data files:
## Root Level Files

* **tests.log:** General log generated by system-tests. Here you will see the Pulumi outputs of the remote provisions.
* **report.json:** Pytest results report in JSON format.
* **reportJunit.xml:** Pytest results report in JUnit XML format.
* **known_versions.json:** Contains information about the known versions of components used in the test.
* **setup_properties.json:** Contains the setup properties and configuration used for the test execution.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages = ["tests", "utils", "manifests"]
dependencies = {file = ["requirements.txt"]}

[tool.pytest.ini_options]
addopts = "--json-report --json-report-indent=2 --color=yes --no-header -r Xf"
addopts = "--color=yes --no-header -r Xf"
testpaths = [
"tests",
]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pulumi-aws==6.38.0 #On Boarding requirements
pulumi-command==0.11.1 #On Boarding requirements
pulumi-tls==5.0.3 #On Boarding requirements
pulumi==3.116.0 #On Boarding requirements
pytest-json-report==1.5.0
pytest-split==0.9.0
pytest-xdist==3.2.1
pytest==7.1.3
Expand Down
2 changes: 1 addition & 1 deletion utils/ci/gitlab/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ variables:
# + utils/ci/gitlab/validate_param_env.py, which is copied into the image)
# Update this when any of these files changes:
# cat utils/ci/gitlab/docker/system-tests.Dockerfile requirements.txt utils/ci/gitlab/validate_param_env.py | sha256sum | cut -c1-12
CI_IMAGE: "registry.ddbuild.io/system-tests/ci-runner:9eb0426b57c3"
CI_IMAGE: "registry.ddbuild.io/system-tests/ci-runner:ebfc794bf64e"
SYSTEM_TESTS_SPLIT_PIPELINE: "$[[ inputs.split_pipeline ]]"

.system_tests_param_base:
Expand Down
2 changes: 1 addition & 1 deletion utils/scripts/gitlab_print_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ -f "${COLLAPSIBLE_LOGS_SCRIPT}" ]; then
while IFS= read -r -d '' file; do
section_id=$(printf '%s' "$file" | tr -c '[:alnum:]' '_')
bash "${COLLAPSIBLE_LOGS_SCRIPT}" "$file" "logs_${LABEL}_${section_id}" "Logs for ${LABEL} - ${file}"
done < <(find reports -type f \! -name report.json \! -name tests.log -print0)
done < <(find reports -type f \! -name tests.log -print0)
else
echo "Skipping collapsible log dump: ${COLLAPSIBLE_LOGS_SCRIPT} not found"
fi
Expand Down
38 changes: 0 additions & 38 deletions utils/scripts/markdown_logs.py

This file was deleted.

Loading