Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci_visibility): create client for test visibility backend API #10752

Merged

Conversation

romainkomorndatadog
Copy link
Collaborator

@romainkomorndatadog romainkomorndatadog commented Sep 22, 2024

This creates a new client for the Test Visibility API (used currently for settings and ITR data, but soon to be used for new test and auto flake retries information).

This is mostly a refactor (eg: the majority of the original logic has been cut and pasted into a new class), with some notable changes:

  • skippable tests/suites are now part of an ITRData dataclass, under the CIVisibility instance's _itr_data attribute
  • checking for test or suite skippability status is done by getting a InternalTestId or a TestSuiteId, and looking for it in _itr_data.skippable_items
  • fetching tests now depends on a new _itr_skipping_ignore_parameters configuration item (this is being introduced for backwards compatibility because parameters were previously not being checked)
  • the TestVisibilityAPISettings replaces the _CIVisibilitySettings namedtuple
  • oodles of tests are updated to match the new behaviors

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@romainkomorndatadog romainkomorndatadog self-assigned this Sep 22, 2024
Copy link
Contributor

github-actions bot commented Sep 22, 2024

CODEOWNERS have been resolved as:

ddtrace/internal/ci_visibility/_api_client.py                           @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/git_data.py                              @DataDog/ci-app-libraries
tests/ci_visibility/api_client/_util.py                                 @DataDog/ci-app-libraries
tests/ci_visibility/api_client/real_world_skippable_response_flask_suite_level.json  @DataDog/ci-app-libraries
tests/ci_visibility/api_client/real_world_skippable_response_flask_test_level.json  @DataDog/ci-app-libraries
tests/ci_visibility/api_client/test_ci_visibility_api_client.py         @DataDog/ci-app-libraries
tests/ci_visibility/api_client/test_ci_visibility_api_client_setting_responses.py  @DataDog/ci-app-libraries
tests/ci_visibility/api_client/test_ci_visibility_api_client_skippable_real_world_responses.py  @DataDog/ci-app-libraries
tests/ci_visibility/api_client/test_ci_visibility_api_client_skippable_responses.py  @DataDog/ci-app-libraries
tests/ci_visibility/test_ci_visibility_check_enabled_features.py        @DataDog/ci-app-libraries
.github/CODEOWNERS                                                      @DataDog/python-guild @DataDog/apm-core-python
ddtrace/contrib/pytest/_plugin_v1.py                                    @DataDog/ci-app-libraries
ddtrace/contrib/pytest/_plugin_v2.py                                    @DataDog/ci-app-libraries
ddtrace/ext/test_visibility/__init__.py                                 @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/api/_base.py                             @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/api/_module.py                           @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/api/_session.py                          @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/api/_test.py                             @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/constants.py                             @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/errors.py                                @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/recorder.py                              @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/telemetry/itr.py                         @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/utils.py                                 @DataDog/ci-app-libraries
ddtrace/internal/test_visibility/coverage_lines.py                      @DataDog/ci-app-libraries
pyproject.toml                                                          @DataDog/python-guild
tests/ci_visibility/api/fake_runner_all_itr_skip_suite_level.py         @DataDog/ci-app-libraries
tests/ci_visibility/api/fake_runner_mix_fail_itr_suite_level.py         @DataDog/ci-app-libraries
tests/ci_visibility/api/test_api_fake_runners.py                        @DataDog/ci-app-libraries
tests/ci_visibility/api/test_internal_test_visibility_api.py            @DataDog/ci-app-libraries
tests/ci_visibility/test_ci_visibility.py                               @DataDog/ci-app-libraries
tests/ci_visibility/test_encoder.py                                     @DataDog/ci-app-libraries
tests/ci_visibility/util.py                                             @DataDog/ci-app-libraries
tests/contrib/asynctest/test_asynctest.py                               @DataDog/ci-app-libraries
tests/contrib/pytest/test_coverage_per_suite.py                         @DataDog/ci-app-libraries
tests/contrib/pytest/test_pytest.py                                     @DataDog/ci-app-libraries
tests/contrib/pytest/test_pytest_snapshot.py                            @DataDog/ci-app-libraries
tests/contrib/pytest/test_pytest_snapshot_v2.py                         @DataDog/ci-app-libraries
tests/contrib/pytest_bdd/test_pytest_bdd.py                             @DataDog/ci-app-libraries
tests/contrib/pytest_benchmark/test_pytest_benchmark.py                 @DataDog/ci-app-libraries
tests/contrib/unittest/test_unittest.py                                 @DataDog/ci-app-libraries
tests/contrib/unittest/test_unittest_snapshot.py                        @DataDog/ci-app-libraries
tests/integration/test_integration_civisibility.py                      @DataDog/ci-app-libraries
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_generates_coverage_correctly.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_generates_coverage_correctly_with_skipped.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_generates_source_file_data.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_force_run_multiple_unskippable_tests.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_force_run_unskippable_tests.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_include_custom_tests.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_include_lines_pct.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_report_coverage_by_test_with_itr_skipped.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_report_coverage_by_test_with_itr_skipped_multiple.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_skip_invalid_unskippable_tests.json  @DataDog/apm-python
tests/snapshots/tests.contrib.unittest.test_unittest_snapshot.test_unittest_will_skip_unskippable_test_if_skip_decorator.json  @DataDog/apm-python

tests/ci_visibility/api_client/_util.py Outdated Show resolved Hide resolved
tests/ci_visibility/api_client/_util.py Outdated Show resolved Hide resolved
ddtrace/internal/ci_visibility/_api_client.py Outdated Show resolved Hide resolved
tests/ci_visibility/api_client/_util.py Outdated Show resolved Hide resolved
tests/ci_visibility/api_client/_util.py Outdated Show resolved Hide resolved
ddtrace/internal/ci_visibility/_api_client.py Outdated Show resolved Hide resolved
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Sep 22, 2024

Datadog Report

Branch report: romain.komorn/SDTEST-854/add_flaky_tests_retry_api
Commit report: f368515
Test service: dd-trace-py

✅ 0 Failed, 616 Passed, 670 Skipped, 20m 43.79s Total duration (16m 22.34s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Sep 22, 2024

Benchmarks

Benchmark execution time: 2024-09-26 08:46:30

Comparing candidate commit f368515 in PR branch romain.komorn/SDTEST-854/add_flaky_tests_retry_api with baseline commit ce6a66a in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 371 metrics, 53 unstable metrics.

@romainkomorndatadog romainkomorndatadog added the changelog/no-changelog A changelog entry is not required for this PR. label Sep 24, 2024
…ky_tests_retry_api' into romain.komorn/SDTEST-854/add_flaky_tests_retry_api
@romainkomorndatadog romainkomorndatadog merged commit 0e1f4eb into main Sep 26, 2024
573 of 574 checks passed
@romainkomorndatadog romainkomorndatadog deleted the romain.komorn/SDTEST-854/add_flaky_tests_retry_api branch September 26, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants