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
10 changes: 4 additions & 6 deletions .github/workflows/component_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,24 @@ jobs:

- name: Build C++ test scenarios with Bazel
run: |
bazel build --config=per-x86_64-linux //tests/cpp_test_scenarios:cpp_test_scenarios
bazel build --config=per-x86_64-linux //tests/test_scenarios/cpp:test_scenarios

- name: Build Rust test scenarios with Bazel
run: |
bazel build //tests/rust_test_scenarios:rust_test_scenarios
bazel build //tests/test_scenarios/rust:test_scenarios

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Set up Python virtual environment
working-directory: tests/python_test_cases
run: |
python -m venv .venv
source .venv/bin/activate
pip install .
pip install -r tests/test_cases/requirements.txt

- name: Run Python tests with pytest
working-directory: tests/python_test_cases
run: |
source .venv/bin/activate
python -m pytest
python -m pytest --traces=all
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ test_suite(
test_suite(
name = "cit_tests",
tests = [
"//tests/python_test_cases:cit_cpp",
"//tests/python_test_cases:cit_rust",
"//tests/test_cases:cit_cpp",
"//tests/test_cases:cit_rust",
],
visibility = ["//visibility:public"],
)
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "2"
members = [
"src/rust/rust_kvs",
"src/rust/rust_kvs_tool",
"tests/rust_test_scenarios",
"tests/test_scenarios/rust",
]


Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen
pip.parse(
hub_name = "pip_score_venv_test",
python_version = PYTHON_VERSION,
requirements_lock = "//tests/python_test_cases:requirements.txt.lock",
requirements_lock = "//tests/test_cases:requirements.txt.lock",
)
use_repo(pip, "pip_score_venv_test")

Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Copy link
Contributor

Choose a reason for hiding this comment

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

Will similar changes be introduced to other repositories? Or is it per-repo?

Copy link
Contributor

Choose a reason for hiding this comment

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

its already on mains in kyron and ref_int

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.pytest]
addopts = ["-v"]
pythonpath = [
"tests/test_cases",
"tests/test_cases/tests",
]
testpaths = ["tests/test_cases/tests"]
markers = [
"root_required", # root permissions are required for this test
"do_not_repeat", # do not repeat this test when using pytest-repeat
"only_nightly", # run this test only in nightly runs
]
junit_log_passing_tests = true

[tool.pytest_env]
RUST_BACKTRACE = {value = "1", skip_if_set = true}
2 changes: 1 addition & 1 deletion src/cpp/src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cc_library(
includes = ["."],
visibility = [
"//:__pkg__",
"//tests/cpp_test_scenarios:__pkg__",
"//tests/test_scenarios/cpp:__pkg__",
],
deps = [
":kvsvalue",
Expand Down
28 changes: 14 additions & 14 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Create `venv`, activate and install dependencies:
```bash
python -m venv <REPO_ROOT>/.venv
source <REPO_ROOT>/.venv/bin/activate
pip install -r <REPO_ROOT>/tests/python_test_cases/requirements.txt
pip install -r <REPO_ROOT>/tests/test_cases/requirements.txt
```

## Usage

Set current working directory to the following:

```bash
cd <REPO_ROOT>/tests/python_test_cases
cd <REPO_ROOT>/tests/test_cases
```

### Run tests
Expand Down Expand Up @@ -75,16 +75,16 @@ Run all Component Integration Tests:
bazel test //:cit_tests
```

When the dependencies in [requirements.txt](python_test_cases/requirements.txt) file are manually modified, the user should invoke command and commit changes:
When the dependencies in [requirements.txt](test_cases/requirements.txt) file are manually modified, the user should invoke command and commit changes:

```bash
bazel run //tests/python_test_cases:requirements.update
bazel run //tests/test_cases:requirements.update
```

In order to update all dependencies use:

```bash
bazel run //tests/python_test_cases:requirements.update -- --upgrade
bazel run //tests/test_cases:requirements.update -- --upgrade
```

## Standalone execution of test scenarios
Expand All @@ -96,7 +96,7 @@ Test scenarios can be run independently from `pytest`.
Set current working directory to the following:

```bash
cd <REPO_ROOT>/tests/rust_test_scenarios
cd <REPO_ROOT>/tests/test_scenarios/rust
```

List all available scenarios:
Expand All @@ -120,44 +120,44 @@ cargo run -- --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
Run test scenario executable directly:

```bash
<REPO_ROOT>/target/debug/rust_test_scenarios --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
<REPO_ROOT>/target/debug/test_scenarios --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
```

### C++

Set current working directory to the following:

```bash
cd <REPO_ROOT>/tests/cpp_test_scenarios
cd <REPO_ROOT>/tests/test_scenarios/cpp
```

List all available scenarios:

```bash
bazel run //tests/cpp_test_scenarios:cpp_test_scenarios -- --list-scenarios
bazel run //tests/test_scenarios/cpp:test_scenarios -- --list-scenarios
```

Run specific test scenario:

```bash
bazel run //tests/cpp_test_scenarios:cpp_test_scenarios -- --name <TEST_GROUP>.<TEST_SCENARIO> --input <TEST_INPUT>
bazel run //tests/test_scenarios/cpp:test_scenarios -- --name <TEST_GROUP>.<TEST_SCENARIO> --input <TEST_INPUT>
```

Example:

```bash
bazel run //tests/cpp_test_scenarios:cpp_test_scenarios -- --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
bazel run //tests/test_scenarios/cpp:test_scenarios -- --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
```

Run test scenario executable directly:

```bash
<REPO_ROOT>/bazel-bin/tests/cpp_test_scenarios/cpp_test_scenarios --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
<REPO_ROOT>/bazel-bin/tests/test_scenarios/cpp/test_scenarios --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
```

Run with GDB:

```bash
bazel build //tests/cpp_test_scenarios:cpp_test_scenarios -c dbg --strip never
gdb --args <REPO_ROOT>/bazel-bin/tests/cpp_test_scenarios/cpp_test_scenarios --name <TEST_GROUP>.<TEST_SCENARIO> --input '{"kvs_parameters":{"instance_id":0}}'
bazel build //tests/test_scenarios/cpp:test_scenarios -c dbg --strip never
gdb --args <REPO_ROOT>/bazel-bin/tests/test_scenarios/cpp/test_scenarios --name <TEST_GROUP>.<TEST_SCENARIO> --input '{"kvs_parameters":{"instance_id":0}}'
```
8 changes: 4 additions & 4 deletions tests/integration_test_scenarios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ genrule(
)

# state the tests too
#TODO: enable when rust_test_scenarios is built for QNX
#TODO: enable when test_scenarios/rust:test_scenarios is built for QNX
#genrule(
# name = "stage_rust_test_scenarios",
# srcs = ["//tests/rust_test_scenarios:rust_test_scenarios"],
# outs = ["install/usr/bin/rust_test_scenarios"],
# srcs = ["//tests/test_scenarios/rust:test_scenarios"],
# outs = ["install/usr/bin/test_scenarios/rust"],
# cmd = """
# mkdir -p $(RULEDIR)/install/usr/bin
# cp $(location //tests/rust_test_scenarios:rust_test_scenarios) $@
# cp $(location //tests/test_scenarios/rust:test_scenarios) $@
# chmod +x $@
# """,
#)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_test_scenarios/init_rpi4.build
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ ldqnx-64.so.2=ldqnx-64.so.2
[uid=0 gid=0 perms=0755] /usr/bin/kvs_test.sh=bazel-out/k8-fastbuild/bin/tests/integration_test_scenarios/install/usr/bin/kvs_test.sh

#TODO: enable when rust_test_scenarios is built for QNX
#[uid=0 gid=0 perms=0755] /usr/bin/rust_test_scenarios=bazel-out/k8-fastbuild/bin/tests/integration_test_scenarios/install/usr/bin/rust_test_scenarios
#[uid=0 gid=0 perms=0755] /usr/bin/test_scenarios/rust=bazel-out/k8-fastbuild/bin/tests/integration_test_scenarios/install/usr/bin/test_scenarios/rust



Expand Down
8 changes: 0 additions & 8 deletions tests/python_test_cases/pyproject.toml

This file was deleted.

16 changes: 8 additions & 8 deletions tests/python_test_cases/BUILD → tests/test_cases/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@score_tooling//python_basics:defs.bzl", "score_py_pytest", "score_virtualenv")

# In order to update the requirements, change the `requirements.in` file and run:
# `bazel run //tests/python_test_cases:requirements.update`.
# `bazel run //tests/test_cases:requirements.update`.
# This will update the `requirements.txt` file.
# To upgrade all dependencies to their latest versions, run:
# `bazel run //tests/python_test_cases:requirements.update -- --upgrade`.
# `bazel run //tests/test_cases:requirements.update -- --upgrade`.
compile_pip_requirements(
name = "requirements",
srcs = [
Expand All @@ -43,16 +43,16 @@ score_py_pytest(
srcs = glob(["tests/**/*.py"]),
args = [
"-m cpp",
"--cpp-target-path=$(rootpath //tests/cpp_test_scenarios)",
"--cpp-target-path=$(rootpath //tests/test_scenarios/cpp:test_scenarios)",
],
data = [
":python_tc_venv",
"//tests/cpp_test_scenarios",
"//tests/test_scenarios/cpp:test_scenarios",
],
env = {
"RUST_BACKTRACE": "1",
},
pytest_ini = "//tests/python_test_cases:pytest.ini",
pytest_ini = "//tests/test_cases:pytest.ini",
deps = all_requirements,
)

Expand All @@ -61,16 +61,16 @@ score_py_pytest(
srcs = glob(["tests/**/*.py"]),
args = [
"-m rust",
"--rust-target-path=$(rootpath //tests/rust_test_scenarios)",
"--rust-target-path=$(rootpath //tests/test_scenarios/rust:test_scenarios)",
],
data = [
":python_tc_venv",
"//tests/rust_test_scenarios",
"//tests/test_scenarios/rust:test_scenarios",
],
env = {
"RUST_BACKTRACE": "1",
},
pytest_ini = "//tests/python_test_cases:pytest.ini",
pytest_ini = "//tests/test_cases:pytest.ini",
deps = all_requirements,
)

Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

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

imho, PYTHONPATH should be added and . removed from import statements in test files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[pytest]
addopts = -v
testpaths = tests
pythonpath = tests
markers =
cpp
rust
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
psutil
pytest-metadata
pytest-env
testing-utils @ git+https://github.com/eclipse-score/testing_tools.git@v0.3.0
testing-utils @ git+https://github.com/eclipse-score/testing_tools.git@675395d4088c8eba708e21d9e5c4efbc75f6a6b0
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace with new version?

Copy link
Contributor

Choose a reason for hiding this comment

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

needed changes are not included in newest release yet

Copy link
Contributor

Choose a reason for hiding this comment

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

Why and what are those changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

eclipse-score/testing_tools#14

enables passing extra options to bazel build - allows flag --build-scenarios to use necessary config

Loading
Loading