elastic / elastic/apm-agent-python

Test failures when running on K8s pods or docker containers locally

オープン
#1,660 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
agent-python
主要言語
Python
スター
431
フォーク
239
平均マージ
5日 10時間
マージ済み PR(30日)
7

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

tests/config/tests.py と test_file_is_readable_validator_not_readable から始め、報告されている Python Docker images で WEBFRAMEWORK=none を指定して tests/scripts/run_tests.sh を通じて再現します。コンテナの権限下でのバリデーターの動作を比較します。影響を受ける Docker および Kubernetes 環境でテストスイートが成功し、想定される読み取り不可ファイルのチェックを壊していなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, kubernetes, python
領域
testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。