Skip to content

Commit e283498

Browse files
committed
test: execute CIT with Bazel
Created bazel targets for component integration tests. Groupped them under one test suite.
1 parent 82ba94e commit e283498

File tree

3 files changed

+88
-7
lines changed

3 files changed

+88
-7
lines changed

src/rust/rust_kvs/BUILD

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,92 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
load("@crates//:defs.bzl", "all_crate_deps")
14-
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
14+
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
1515

1616
rust_library(
1717
name = "rust_kvs",
18-
srcs = ["src/lib.rs"],
18+
srcs = glob(["src/**/*.rs"]),
1919
visibility = ["//visibility:public"],
2020
deps = all_crate_deps(
2121
normal = True,
2222
),
2323
)
24+
25+
__cit_deps = [
26+
":rust_kvs",
27+
] + all_crate_deps(
28+
normal = True,
29+
normal_dev = True,
30+
)
31+
32+
rust_test(
33+
name = "cit_default_values",
34+
srcs = ["tests/cit_default_values.rs"],
35+
crate_root = "tests/cit_default_values.rs",
36+
tags = [
37+
"cit",
38+
"component_tests",
39+
],
40+
deps = __cit_deps,
41+
)
42+
43+
rust_test(
44+
name = "cit_multiple_kvs",
45+
srcs = ["tests/cit_multiple_kvs.rs"],
46+
crate_root = "tests/cit_multiple_kvs.rs",
47+
tags = [
48+
"cit",
49+
"component_tests",
50+
],
51+
deps = __cit_deps,
52+
)
53+
54+
rust_test(
55+
name = "cit_persistency",
56+
srcs = [
57+
"tests/cit_persistency.rs",
58+
"tests/common.rs",
59+
],
60+
crate_root = "tests/cit_persistency.rs",
61+
tags = [
62+
"cit",
63+
"component_tests",
64+
],
65+
deps = __cit_deps,
66+
)
67+
68+
rust_test(
69+
name = "cit_snapshots",
70+
srcs = ["tests/cit_snapshots.rs"],
71+
crate_root = "tests/cit_snapshots.rs",
72+
tags = [
73+
"cit",
74+
"component_tests",
75+
],
76+
deps = __cit_deps,
77+
)
78+
79+
rust_test(
80+
name = "cit_supported_datatypes",
81+
srcs = [
82+
"tests/cit_supported_datatypes.rs",
83+
"tests/common.rs",
84+
],
85+
crate_root = "tests/cit_supported_datatypes.rs",
86+
tags = [
87+
"cit",
88+
"component_tests",
89+
],
90+
deps = __cit_deps,
91+
)
92+
93+
test_suite(
94+
name = "cit",
95+
tests = [
96+
":cit_default_values",
97+
":cit_multiple_kvs",
98+
":cit_persistency",
99+
":cit_snapshots",
100+
":cit_supported_datatypes",
101+
],
102+
)

src/rust/rust_kvs/tests/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ SPDX-License-Identifier: Apache-2.0
2020
All tests are kept in separate files as the working directory is always
2121
changed. If there is more than one test in a file both tests are run in
2222
parallel and use the same working directory which will led to wrong results.
23+
24+
## Bazel instruction
25+
26+
In order to run all Component Integration Tests with Bazel there is a single Test Suite created, which can be executed with:
27+
```bash
28+
bazel test //src/rust/rust_kvs:cit
29+
```

src/rust/rust_kvs/tests/kvs_0_default.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)