elastic / elastic/apm-agent-python

Test failures when running on K8s pods or docker containers locally

Offen
#1,660 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
agent-python
Vorherrschende Sprache
Python
Sterne
431
Forks
239
Ø Merge
5 T. 10 Std.
Gemergte PRs (30 T.)
7

Beschreibung

I'm running `tests/scripts/run_tests.sh` with the `WEBFRAMEWORK=none` using the container `python:3.8`

```
=================================== FAILURES ===================================
_________________ test_file_is_readable_validator_not_readable _________________

tmpdir = local('/tmp/pytest-of-root/pytest-0/test_file_is_readable_validato2')

@pytest.mark.skipif(platform.system() == "Windows", reason="os.access() doesn't seem to work as we expect on Windows")
def test_file_is_readable_validator_not_readable(tmpdir):
p = tmpdir.join("nonreadable")
p.write("")
os.chmod(p.strpath, stat.S_IWRITE)
validator = FileIsReadableValidator()
with pytest.raises(ConfigurationError) as e:
> validator(p.strpath, "path")
E Failed: DID NOT RAISE

e =
p = local('/tmp/pytest-of-root/pytest-0/test_file_is_readable_validato2/nonreadable')
tmpdir = local('/tmp/pytest-of-root/pytest-0/test_file_is_readable_validato2')
validator =

tests/config/tests.py:287: Failed
=============================== warnings summary ===============================
tests/client/transaction_tests.py::test_transaction_span_stack_trace_min_duration_overrides_old_config
tests/client/transaction_tests.py::test_transaction_span_stack_trace_min_duration_overrides_old_config
tests/client/transaction_tests.py::test_transaction_span_stack_trace_min_duration_overrides_old_config
tests/client/transaction_tests.py::test_transaction_span_stack_trace_min_duration_overrides_old_config
/code/elasticapm/traces.py:909: DeprecationWarning: `span_frames_min_duration` is deprecated. Please use `span_stack_trace_min_duration`.
warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/config/tests.py::test_file_is_readable_validator_not_readable - ...
============ 1 failed, 685 passed, 50 skipped, 4 warnings in 49.70s ============
make: *** [Makefile:14: test] Error 1
```

A similar error for other different python versions: `3.6`, `3.7`, `3.9` and `3.10`

You can reproduce the error with the below command that runs in one of the docker images I've created for testing [`skaffold`](https://github.com/elastic/apm-agent-python/pull/1659):

```bash
docker run --rm -ti docker.elastic.co/beats-dev/apm-agent-python-3_10:v6.12.0-19-gdf6fc75d-dirty@sha256:ad548ceef42ed963c373b0b28ab3b3d33ac016e886fe82d2fce5d8443f753783 /bin/bash -c "WEBFRAMEWORK=none tests/scripts/run_tests.sh"
```

The docker image content:

```Dockerfile
ARG VERSION
FROM python:${VERSION}
WORKDIR /code
ADD . .
ENV WEBFRAMEWORK=none
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit tests/config/tests.py und test_file_is_readable_validator_not_readable und reproduziere den Fehler anschließend über tests/scripts/run_tests.sh mit WEBFRAMEWORK=none in den gemeldeten Python Docker images. Vergleiche das Verhalten des Validators unter den Container-Berechtigungen; abgeschlossen ist die Aufgabe, wenn die Testsuite in den betroffenen Docker- und Kubernetes-Umgebungen erfolgreich durchläuft, ohne die erwartete Prüfung auf nicht lesbare Dateien zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, kubernetes, python
Bereich
testing-qa
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.