Skip to content

Environment for integration tests #270

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

Merged
merged 36 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
04faa09
divided the tests into groups
stanislav-shchetinin Jul 19, 2024
e7c81f9
basic_example integration test
stanislav-shchetinin Jul 19, 2024
bf8d49e
fix test: now -> 0
stanislav-shchetinin Jul 22, 2024
8cf44ff
CMakePresets divided the tests
stanislav-shchetinin Jul 22, 2024
bc64874
remove launch basic example
stanislav-shchetinin Jul 23, 2024
24565ee
return examples in pr_check.yaml
stanislav-shchetinin Jul 23, 2024
a996b48
changed database
stanislav-shchetinin Jul 23, 2024
f11127d
changed database
stanislav-shchetinin Jul 23, 2024
cb18119
divided into different jobs
stanislav-shchetinin Jul 23, 2024
27bd629
fix tests.yaml
stanislav-shchetinin Jul 23, 2024
ddb26b3
fix tests.yaml
stanislav-shchetinin Jul 23, 2024
d625fb0
fix tests
stanislav-shchetinin Jul 23, 2024
bb7b604
groups in tests
stanislav-shchetinin Jul 23, 2024
53e37bd
fix spaces in yaml
stanislav-shchetinin Jul 23, 2024
02ecbf3
added examples & remoed macOS
stanislav-shchetinin Jul 23, 2024
60258e0
fix examples
stanislav-shchetinin Jul 23, 2024
148cded
database & endpoint in env
stanislav-shchetinin Jul 23, 2024
5916be7
added labels for tests & devided test groups by labels
stanislav-shchetinin Jul 24, 2024
ea3bac8
added docker-compose.yaml from rust-sdk
stanislav-shchetinin Jul 24, 2024
2608352
added env in tests release
stanislav-shchetinin Jul 24, 2024
99dde83
added lib
stanislav-shchetinin Jul 25, 2024
c09ba03
json for SelectSimple
stanislav-shchetinin Jul 25, 2024
f648733
comparing json in a test
stanislav-shchetinin Jul 26, 2024
354ba24
fix after review
stanislav-shchetinin Jul 27, 2024
f71353f
pulling a vector into a string
stanislav-shchetinin Jul 29, 2024
0b71705
remove extra spaces
stanislav-shchetinin Jul 29, 2024
99108f7
pathsplit -> std::filesystem::path & ui64 -> uint64_t
stanislav-shchetinin Jul 29, 2024
0056b4a
space
stanislav-shchetinin Jul 29, 2024
66fa321
order by
stanislav-shchetinin Jul 29, 2024
1547afc
ut -> unit
stanislav-shchetinin Jul 29, 2024
3108bec
added retry
stanislav-shchetinin Jul 29, 2024
98bc556
fix after review
stanislav-shchetinin Jul 29, 2024
b8336da
fix env_ut
stanislav-shchetinin Jul 29, 2024
900d86a
fix after review
stanislav-shchetinin Jul 30, 2024
b225192
fix after review
stanislav-shchetinin Jul 30, 2024
fd62573
fix examples
stanislav-shchetinin Jul 30, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR-check
name: Examples

on:
push:
Expand All @@ -10,13 +10,17 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
jobs:
main:
name: PR check for YDB C++ SDK
name: Examples
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
ydb-version: [23.3, 24.1, trunk]
services:
ydb:
image: ydbplatform/local-ydb:latest
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
ports:
- 2135:2135
- 2136:2136
Expand Down Expand Up @@ -57,10 +61,6 @@ jobs:
ubuntu-22.04-ccache-
- name: Build
uses: ./.github/actions/build
- name: Test
shell: bash
run: |
ctest -j32 --preset release
- name: Launch basic example
shell: bash
run: |
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
unit:
concurrency:
group: unit-${{ github.ref }}-${{ matrix.os }}
cancel-in-progress: true
strategy:
fail-fast: false
env:
OS: ubuntu-22.04
runs-on: ubuntu-22.04
steps:
- name: Checkout PR
uses: actions/checkout@v3
if: github.event.pull_request.head.sha != ''
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout
uses: actions/checkout@v3
if: github.event.pull_request.head.sha == ''
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/prepare_vm
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Restore cache files
uses: actions/cache/restore@v4
with:
path: ~/.ccache
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: |
ubuntu-22.04-ccache-
- name: Build
uses: ./.github/actions/build
- name: Test
shell: bash
run: |
ctest -j32 --preset release-unit

integration:
concurrency:
group: integration-${{ github.ref }}-${{ matrix.ydb-version }}
cancel-in-progress: true
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
ydb-version: [23.3, 24.1, trunk]
services:
ydb:
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
ports:
- 2135:2135
- 2136:2136
- 8765:8765
volumes:
- /tmp/ydb_certs:/ydb_certs
env:
YDB_LOCAL_SURVIVE_RESTART: true
YDB_USE_IN_MEMORY_PDISKS: true
YDB_TABLE_ENABLE_PREPARED_DDL: true
options: '-h localhost'
steps:
- name: Checkout PR
uses: actions/checkout@v3
if: github.event.pull_request.head.sha != ''
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout
uses: actions/checkout@v3
if: github.event.pull_request.head.sha == ''
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/prepare_vm
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Restore cache files
uses: actions/cache/restore@v4
with:
path: ~/.ccache
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: |
ubuntu-22.04-ccache-
- name: Build
uses: ./.github/actions/build
- name: Test
shell: bash
run: |
ctest -j32 --preset release-integration
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ endif()

if (YDB_SDK_TESTS)
enable_testing()
add_subdirectory(tests)
add_subdirectory(tests/unit)
add_subdirectory(tests/integration)
endif()

if (YDB_SDK_INSTALL)
Expand Down
40 changes: 40 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,46 @@
},
"execution": {
"timeout": 1200
},
"environment": {
"YDB_ENDPOINT": "localhost:2136",
"YDB_DATABASE": "/local"
}
},
{
"name": "release-unit",
"configurePreset": "release",
"displayName": "Default Unit Release Tests",
"filter" : {
"include": {
"label": "unit"
}
},
"output": {
"outputOnFailure": true
},
"execution": {
"timeout": 1200
}
},
{
"name": "release-integration",
"configurePreset": "release",
"displayName": "Default Integration Release Tests",
"output": {
"outputOnFailure": true
},
"filter" : {
"include": {
"label": "integration"
}
},
"execution": {
"timeout": 1200
},
"environment": {
"YDB_ENDPOINT": "localhost:2136",
"YDB_DATABASE": "/local"
}
}
]
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ cmake --build --preset release

Specify a level of parallelism by passing the `-j<level>` option into the command below (e.g. `-j$(nproc)`)

Running all tests:

```bash
ctest -j$(nproc) --preset release
```

Running unit tests only:

```bash
ctest -j$(nproc) --preset release-unit
```

Running integration tests only:

```bash
ctest -j$(nproc) --preset release-integration
```
3 changes: 2 additions & 1 deletion cmake/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ endfunction()
function(add_ydb_test)
set(opts "")
set(oneval_args NAME)
set(multival_args INCLUDE_DIRS SOURCES LINK_LIBRARIES)
set(multival_args INCLUDE_DIRS SOURCES LINK_LIBRARIES LABELS)
cmake_parse_arguments(YDB_TEST
"${opts}"
"${oneval_args}"
Expand Down Expand Up @@ -121,6 +121,7 @@ function(add_ydb_test)
PROPERTY
LABELS
MEDIUM
${YDB_TEST_LABELS}
)

set_yunittest_property(
Expand Down
2 changes: 0 additions & 2 deletions examples/basic_example/basic_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <ydb-cpp-sdk/util/string/cast.h>

#include <src/util/folder/pathsplit.h>

#include <filesystem>
#include <format>

Expand Down
1 change: 1 addition & 0 deletions tests/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(basic_example_it)
14 changes: 14 additions & 0 deletions tests/integration/basic_example_it/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_ydb_test(NAME basic-example_it
SOURCES
main.cpp
basic_example_data.cpp
basic_example.cpp
basic_example.h
LINK_LIBRARIES
yutil
YDB-CPP-SDK::Table
GTest::gtest_main
public-lib-json_value
LABELS
integration
)
Loading
Loading