elastic / elastic/apm-agent-python
Test failures when running on K8s pods or docker containers locally
- Dominant language
- Python
- Stars
- 431
- Forks
- 239
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 7
Description
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
```
Contributor guide
Assessment
This issue has not been assessed yet.