Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/slo-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,38 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_run_id: ${{ github.event.workflow_run.id }}


remove-slo-label:
if: always() && github.event.workflow_run.event == 'pull_request'
name: Remove SLO Label
needs: ydb-slo-action-report
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Remove SLO label from PR
uses: actions/github-script@v7
with:
script: |
const pullRequests = context.payload.workflow_run.pull_requests;
if (pullRequests && pullRequests.length > 0) {
for (const pr of pullRequests) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: 'SLO'
});
console.log(`Removed SLO label from PR #${pr.number}`);
} catch (error) {
if (error.status === 404) {
console.log(`SLO label not found on PR #${pr.number}, skipping`);
} else {
throw error;
}
}
}
} else {
console.log('No pull requests associated with this workflow run');
}
4 changes: 3 additions & 1 deletion .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ name: Style checks

on:
push:
branches:
- main
pull_request:

jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
Expand Down
47 changes: 33 additions & 14 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Functional tests
name: Tests

on:
push:
Expand All @@ -7,26 +7,18 @@ on:
pull_request:

jobs:
build:
integration:
runs-on: ubuntu-latest

concurrency:
group: unit-${{ github.ref }}-${{ matrix.environment }}-${{ matrix.python-version }}-${{ matrix.folder }}
group: integration-${{ github.ref }}-${{ matrix.python-version }}-${{ matrix.protobuf-version }}
cancel-in-progress: true

strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
environment: [py, py-tls, py-proto4, py-tls-proto4, py-proto3, py-tls-proto3]
folder: [ydb, tests]
exclude:
- environment: py-tls
folder: ydb
- environment: py-tls-proto4
folder: ydb
- environment: py-tls-proto3
folder: ydb
python-version: ["3.8", "3.9", "3.10", "3.11"]
protobuf-version: [proto3, proto4, proto5, proto6]

steps:
- uses: actions/checkout@v1
Expand All @@ -41,4 +33,31 @@ jobs:
pip install tox==4.2.6

- name: Run unit tests
run: tox -e ${{ matrix.environment }} -- ${{ matrix.folder }}
run: tox -e py-${{ matrix.protobuf-version }} -- tests

unit:
runs-on: ubuntu-latest

concurrency:
group: unit-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox==4.2.6

- name: Run unit tests
run: tox -e py -- ydb
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ protobuf-4:

protobuf-5:
docker build -f generate-protobuf.Dockerfile . -t ydb-python-sdk-proto-generator-env-5 --build-arg PY_PROTOBUF_VER=5.26.1 --build-arg PROTOC_VER=26.1
docker run --rm -it -v $${PWD}:$${PWD} -w $${PWD} ydb-python-sdk-proto-generator-env-5 python generate_protoc.py --target-version=v5
docker run --rm -it -v $${PWD}:$${PWD} -w $${PWD} ydb-python-sdk-proto-generator-env-5 python generate_protoc.py --target-version=v5

protobuf-6:
docker build -f generate-protobuf.Dockerfile . -t ydb-python-sdk-proto-generator-env-6 --build-arg GRPCIO_VER=1.76.0 --build-arg PY_PROTOBUF_VER=6.30.2 --build-arg PROTOC_VER=30.2
docker run --rm -it -v $${PWD}:$${PWD} -w $${PWD} ydb-python-sdk-proto-generator-env-6 python generate_protoc.py --target-version=v6
14 changes: 0 additions & 14 deletions docker-compose-tls.yml

This file was deleted.

5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
version: "3.3"
version: "3.9"
services:
ydb:
image: ydbplatform/local-ydb:trunk
restart: always
ports:
- 2136:2136
- 2135:2135
hostname: localhost
volumes:
- ./ydb_certs:/ydb_certs
environment:
- YDB_ENABLE_COLUMN_TABLES=true
- YDB_USE_IN_MEMORY_PDISKS=true
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
grpcio>=1.42.0
packaging
protobuf>=3.13.0,<6.0.0
protobuf>=3.13.0,<7.0.0
aiohttp<4
10 changes: 5 additions & 5 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ iniconfig==1.1.1
jsonschema==3.2.0
packaging==21.0
paramiko==2.10.1
pluggy==0.13.1
protobuf>=3.13.0,<6.0.0
py==1.10.0
pluggy>=1.0.0
protobuf>=3.13.0,<7.0.0
py>=1.11.0
pycparser==2.20
PyNaCl==1.4.0
pyparsing==2.4.7
pyrsistent==0.18.0
pytest<8.0.0
pytest>=7.0.0,<8.0.0
pytest-asyncio==0.21.0
pytest-docker>=3.0.0
python-dotenv==0.18.0
Expand All @@ -35,7 +35,7 @@ typing-extensions==4.12.2
urllib3==1.26.6
websocket-client==0.59.0
zipp==3.19.1
aiohttp==3.7.4
aiohttp>=3.9.0
pytest-pep8
pytest-flake8
flake8==3.9.2
Expand Down
1 change: 1 addition & 0 deletions tests/ssl/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ def test_connect_secure(secure_endpoint, database):
) as driver:
driver.wait(timeout=10)
driver.scheme_client.make_directory("/local/test")
driver.scheme_client.remove_directory("/local/test")
3 changes: 3 additions & 0 deletions tests/table/test_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def test_tx_snapshot_ro(driver_sync, database):
)
assert data[0].rows == [{"value": 2}]

with suppress(ydb.issues.SchemeError):
session.drop_table(tb_name)


def test_split_transactions_deny_split(driver_sync, table_name):
with ydb.SessionPool(driver_sync, 1) as pool:
Expand Down
58 changes: 12 additions & 46 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,84 +12,50 @@ setenv =
deps =
-r{toxinidir}/test-requirements.txt

[testenv:dev-proto5]
[testenv:py]
commands =
pytest -v {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<6.0.0
protobuf<7.0.0

[testenv:dev-proto4]
[testenv:py-proto6]
commands =
pytest -v {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<5.0.0
protobuf<7.0.0

[testenv:dev-proto3]
[testenv:py-proto5]
commands =
deps =
-r{toxinidir}/test-requirements.txt
protobuf<4.0.0

[testenv:py]
commands =
pytest -v -m "not tls" {posargs}
pytest -v {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<6.0.0

[testenv:py-proto4]
commands =
pytest -v -m "not tls" {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<5.0.0

[testenv:py-cov-proto4]
commands =
pytest -v -m "not tls" \
--cov-report html:cov_html --cov=ydb \
{posargs}
pytest -v {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<5.0.0

[testenv:py-proto3]
commands =
pytest -v -m "not tls" {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<4.0.0

[testenv:py-tls]
commands =
pytest -v -m tls --docker-compose-file=docker-compose-tls.yml {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<6.0.0

[testenv:py-tls-proto4]
commands =
pytest -v -m tls --docker-compose-file=docker-compose-tls.yml {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<5.0.0

[testenv:py-tls-proto3]
commands =
pytest -v -m tls --docker-compose-file=docker-compose-tls.yml {posargs}
pytest -v {posargs}
deps =
-r{toxinidir}/test-requirements.txt
protobuf<4.0.0

[testenv:black-format]
skip_install = true
commands =
black ydb examples tests --extend-exclude "ydb/_grpc/v3|ydb/_grpc/v4|ydb/_grpc/v5"
black ydb examples tests --extend-exclude "ydb/_grpc/v3|ydb/_grpc/v4|ydb/_grpc/v5|ydb/_grpc/v6"

[testenv:black]
skip_install = true
commands =
black --diff --check ydb examples tests --extend-exclude "ydb/_grpc/v3|ydb/_grpc/v4|ydb/_grpc/v5"
black --diff --check ydb examples tests --extend-exclude "ydb/_grpc/v3|ydb/_grpc/v4|ydb/_grpc/v5|ydb/_grpc/v6"

[testenv:pylint]
deps = pylint
Expand Down
11 changes: 10 additions & 1 deletion ydb/_grpc/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,20 @@

sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v4.protos"]

else:
elif protobuf_version < Version("6.0"):
from ydb._grpc.v5 import * # noqa

sys.modules["ydb._grpc.common"] = sys.modules["ydb._grpc.v5"]

from ydb._grpc.v5 import protos # noqa

sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v5.protos"]

else:
from ydb._grpc.v6 import * # noqa

sys.modules["ydb._grpc.common"] = sys.modules["ydb._grpc.v6"]

from ydb._grpc.v6 import protos # noqa

sys.modules["ydb._grpc.common.protos"] = sys.modules["ydb._grpc.v6.protos"]
Empty file added ydb/_grpc/v6/__init__.py
Empty file.
Empty file added ydb/_grpc/v6/draft/__init__.py
Empty file.
Empty file.
Loading
Loading