Skip to content

Add unit tests for previously-untested modules; fix DynamicConfig.get_config()#858

Open
vgvoleg wants to merge 2 commits into
mainfrom
coverage-client-wrappers
Open

Add unit tests for previously-untested modules; fix DynamicConfig.get_config()#858
vgvoleg wants to merge 2 commits into
mainfrom
coverage-client-wrappers

Conversation

@vgvoleg

@vgvoleg vgvoleg commented Jul 7, 2026

Copy link
Copy Markdown
Member

Adds unit tests (no server required, tests/unit/) for previously-untested modules, taking each to 100%:

Module Before After
export.py 36% 100%
import_client.py 48% 100%
scripting.py 49% 100%
operation.py 51% 100%
draft/dynamic_config.py 44% 100%
global_settings.py 22% 100%
tracing.py 60% 100%
_topic_reader/events.py 54% 100%
opentelemetry/__init__.py 69% 100%

Bug fix: DynamicConfigClient.get_config() raised TypeError_wrap_dynamic_config indexed the singular identity/config protobuf fields as if repeated ([0]). Reverted to attribute access; the new tests cover this path.

Dead code removed: ydb/_grpc/grpcwrapper/ydb_scheme.py — an orphaned scheme-entry dataclass, never imported by anything (topic describe uses ydb/scheme.py).

Tests live in tests/unit/ (out of the shipped ydb/ package).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a parsing bug in the draft Dynamic Config client and adds a new set of unit tests for several client wrapper modules, with CI updates to include the new unit-test locations in coverage runs.

Changes:

  • Fix _wrap_dynamic_config() to treat identity/config as singular protobuf fields (no [0] indexing).
  • Add unit tests under tests/unit/ covering scripting, operation, import/export wrappers, global settings, and dynamic config wrappers.
  • Update the GitHub Actions coverage workflow to split “unit” vs “integration” coverage runs around tests/unit/.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ydb/draft/dynamic_config.py Fixes DynamicConfigClient.get_config() response wrapping (singular field access).
tests/unit/test_scripting.py New unit tests for scripting request factories, wrappers, and dispatch behavior.
tests/unit/test_operation.py New unit tests for operation request/response helpers and client/operation dispatch.
tests/unit/test_import_client.py New unit tests for import-from-S3 settings/request factory and dispatch/wrappers.
tests/unit/test_global_settings.py New unit tests for global settings toggles and warning behavior.
tests/unit/test_export.py New unit tests for export settings/request factories and dispatch/wrappers.
tests/unit/test_dynamic_config.py New unit tests covering dynamic config request factories, wrappers, and dispatch (incl. the fixed path).
tests/unit/__init__.py Adds tests.unit package marker for the new unit-test suite.
CHANGELOG.md Adds a user-facing entry for the DynamicConfigClient.get_config() bug fix.
.github/workflows/tests.yaml Adjusts coverage jobs to run tests/unit/ under “unit” and ignore them under “integration”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 72 to +74
def _wrap_dynamic_config(config_pb, dynamic_config_cls=None, *args, **kwargs):
dynamic_config_cls = DynamicConfig if dynamic_config_cls is None else dynamic_config_cls
return dynamic_config_cls(
config_pb.identity[0].version, config_pb.identity[0].cluster, config_pb.config[0], *args, **kwargs
)
return dynamic_config_cls(config_pb.identity.version, config_pb.identity.cluster, config_pb.config, *args, **kwargs)
Comment thread .github/workflows/tests.yaml Outdated
Comment on lines +92 to +95
- name: Unit tests with coverage
env:
COVERAGE_CORE: sysmon
run: tox -e cov -- ydb
run: tox -e cov -- ydb tests/unit
Cover export, import, scripting, operation, dynamic_config and
global_settings with unit tests (tests/unit/, no server needed) —
all six modules to 100%. Fixes get_config() raising TypeError from
indexing singular protobuf fields. CI counts tests/unit/ as unit.
@vgvoleg vgvoleg force-pushed the coverage-client-wrappers branch from 320ef92 to 9b82c88 Compare July 7, 2026 17:11
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.09%. Comparing base (dc20074) to head (c8fe392).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #858      +/-   ##
==========================================
+ Coverage   81.30%   84.09%   +2.78%     
==========================================
  Files          94       93       -1     
  Lines       12162    12131      -31     
  Branches     1194     1194              
==========================================
+ Hits         9888    10201     +313     
+ Misses       1809     1470     -339     
+ Partials      465      460       -5     
Flag Coverage Δ
integration 81.87% <100.00%> (+2.78%) ⬆️
unit 47.40% <0.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ydb/draft/dynamic_config.py 100.00% <100.00%> (+56.33%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ts, opentelemetry

The grpcwrapper ydb_scheme Entry dataclass was orphaned since it was
added — topic describe uses ydb/scheme.py instead, and it was never
imported. Drop it and cover tracing, topic reader events and the
opentelemetry entrypoint with unit tests (all three to 100%).
@vgvoleg vgvoleg changed the title Add unit tests for client wrappers; fix DynamicConfig.get_config() Add unit tests for previously-untested modules; fix DynamicConfig.get_config() Jul 7, 2026
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