Skip to content

Fix K8s lib injection ruff rules (ANN201, B006, B007, B904)#7021

Open
robertomonteromiguel wants to merge 1 commit into
mainfrom
robertomonteromiguel/k8s_ruff
Open

Fix K8s lib injection ruff rules (ANN201, B006, B007, B904)#7021
robertomonteromiguel wants to merge 1 commit into
mainfrom
robertomonteromiguel/k8s_ruff

Conversation

@robertomonteromiguel
Copy link
Copy Markdown
Collaborator

Summary

  • Fix ruff violations in K8s lib injection utilities and scenario code: return type annotations (ANN201), mutable argument defaults (B006), unused loop variables (B007), and exception chaining (raise instead of raise e, B904).
  • Remove the corresponding per-file-ignores from pyproject.toml for utils/k8s_lib_injection/* and utils/_context/_scenarios/k8s_lib_injection.py.

Test plan

  • ruff check utils/k8s_lib_injection/ utils/_context/_scenarios/k8s_lib_injection.py
  • CI lint/format checks pass on PR

Made with Cursor

Enable ANN201, B006, B007, and B904 in K8s lib injection utilities by
adding return types, avoiding mutable defaults, and fixing exception
chaining. Drop the corresponding per-file-ignores from pyproject.toml.

Co-authored-by: Cursor <cursoragent@cursor.com>
@robertomonteromiguel robertomonteromiguel requested a review from a team as a code owner May 26, 2026 14:39
@github-actions
Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

pyproject.toml                                                          @DataDog/system-tests-core
utils/_context/_scenarios/k8s_lib_injection.py                          @DataDog/system-tests-core
utils/k8s_lib_injection/k8s_cluster_provider.py                         @DataDog/system-tests-core
utils/k8s_lib_injection/k8s_command_utils.py                            @DataDog/system-tests-core
utils/k8s_lib_injection/k8s_datadog_kubernetes.py                       @DataDog/system-tests-core

@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented May 26, 2026

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 4 Pipeline jobs failed

Testing the test | System Tests (python, dev) / End-to-end #1 / uwsgi-poc 1   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). 1 failed test. Assertion Error: no extra_services contains extraVegetables at tests/remote_config/test_remote_configuration.py:267.

🧪 1 Test failed

tests.remote_config.test_remote_configuration.Test_RemoteConfigurationExtraServices.test_tracer_extra_services[uwsgi-poc] from system_tests_suite   View in Datadog (Fix with Cursor)
AssertionError: no extra_services contains extraVegetables
assert []

self = &lt;tests.remote_config.test_remote_configuration.Test_RemoteConfigurationExtraServices object at 0x7f3a83199f40&gt;

    def test_tracer_extra_services(self):
        &#34;&#34;&#34;Test extra services field&#34;&#34;&#34;
    
        # filter extra services
        extra_services = []
...

DataDog/system-tests | php-app.amd64.DOC: [public.ecr.aws/lts/ubuntu:22.04, linux/amd64, 7.4]   View in Datadog   GitLab

🔧 Fix in code (Fix with Cursor). 2 failed tests. Assertion Error: No traces found for request SUUXPMNKNFGLEFVKPLNTYVEVHVKHYOXUAQWR and telemetry data is empty.

DataDog/system-tests | Debian_11_amd64.INS: [test-app-dotnet-container]   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. Job failed due to build script execution timing out after 3 attempts, each lasting 240 seconds.

View all 4 failed jobs.

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3abb2b2 | Docs | Datadog PR Page | Give us feedback!

with_datadog_operator: bool = False,
with_cluster_agent: bool = True,
scenario_groups: list[ScenarioGroup] = [scenario_groups.all, scenario_groups.lib_injection],
scenario_groups: list[ScenarioGroup] | None = None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks group, no ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it shouldn't ...I guess... Line 42:
if scenario_groups is None: scenario_groups = DEFAULT_K8S_SCENARIO_GROUPS

Copy link
Copy Markdown
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small non blocking question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants