Skip to content

Commit 2ea04c5

Browse files
committed
[rust] Fix integration tests in Bazel
1 parent 835481a commit 2ea04c5

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,11 @@ More information about running Selenium's .NET tests can be found in this [READM
310310

311311
Targets:
312312

313-
| Command | Description |
314-
|---------------------------------------|-------------------------------------|
315-
| `bazel build //rust:selenium-manager` | Build selenium-manager binary |
316-
| `bazel test //rust/...` | Run both unit and integration tests |
313+
| Command | Description |
314+
|---------------------------------------------------|-------------------------------------------|
315+
| `bazel build //rust:selenium-manager` | Build selenium-manager binary |
316+
| `bazel test //rust/...` | Run both unit and integration tests |
317+
| `CARGO_BAZEL_REPIN=true bazel sync --only=crates` | Sync `Cargo.Bazel.lock` with `Cargo.lock` |
317318

318319
</details>
319320

rust/BUILD.bazel

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@crates//:defs.bzl", "all_crate_deps")
2-
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
2+
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test", "rust_test_suite")
33

44
# We want the release versions of Selenium to include the prebuilt
55
# binaries, but if we're doing day-to-day dev work, then we should
@@ -98,18 +98,21 @@ rust_test(
9898
tags = ["no-sandbox"],
9999
)
100100

101-
[
102-
rust_test(
103-
name = file[:-3],
104-
size = "small",
105-
srcs = [file],
106-
data = [":selenium-manager"],
107-
edition = "2021",
108-
tags = ["no-sandbox"],
109-
deps = [":selenium_manager"] + all_crate_deps(
110-
normal = True,
111-
normal_dev = True,
112-
),
113-
)
114-
for file in glob(["tests/**/*.rs"])
115-
]
101+
rust_test_suite(
102+
name = "integration",
103+
size = "small",
104+
srcs = glob(["tests/**/*_tests.rs"]),
105+
data = [
106+
"tests/common.rs",
107+
":selenium-manager",
108+
],
109+
edition = "2021",
110+
tags = [
111+
"no-sandbox",
112+
"requires-network",
113+
],
114+
deps = [":selenium_manager"] + all_crate_deps(
115+
normal = True,
116+
normal_dev = True,
117+
),
118+
)

0 commit comments

Comments
 (0)