elastic / elastic/apm-agent-python

Test failures when running on K8s pods or docker containers locally

Abierto
#1,660 1 comentario 0 reacciones 0 asignados Ver en GitHub
agent-python
Lenguaje dominante
Python
Estrellas
431
Forks
239
Merge medio
5 d 10 h
PR fusionados (30 d)
7

Descripción

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
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con tests/config/tests.py y test_file_is_readable_validator_not_readable, y después reprodúcelo mediante tests/scripts/run_tests.sh con WEBFRAMEWORK=none en las Python Docker images indicadas. Compara el comportamiento del validador con los permisos del contenedor; se considera terminado cuando la suite de pruebas pasa en los entornos Docker y Kubernetes afectados sin romper la comprobación esperada de archivos no legibles.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
docker, kubernetes, python
Área
testing-qa
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.