Skip to content

Commit 481a430

Browse files
authored
Enable rust tests in RBE builds (SeleniumHQ#15516)
1 parent e4319a2 commit 481a430

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

.skipped-tests

-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,3 @@
5757
-//rb/spec/integration/selenium/webdriver:element-chrome-bidi
5858
-//rb/spec/integration/selenium/webdriver:element-chrome-remote
5959
-//rb/spec/integration/selenium/webdriver:action_builder-firefox-beta-remote
60-
-//rust/tests/...

common/remote-build/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ platform(
4040
exec_properties = {
4141
"container-image": "docker://docker.io/selenium/selenium-remote-build@sha256:ca164352826812f02eaa1b4dab89adcf5b3e57deb6798dd9f15d004099db59fe",
4242
"OSFamily": "Linux",
43+
"dockerNetwork": "standard", # Allow internet access for the Rust tests
4344
"dockerReuse": "True",
4445
"dockerRunAsRoot": "False",
4546
"dockerUseEntrypoint": "True",

rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ fs_extra = "1.3.0"
4141

4242
[dev-dependencies]
4343
assert_cmd = "2.0.16"
44-
rstest = "0.19.0"
4544
is_executable = "1.0.4"
45+
rstest = "0.19.0"
4646

4747
[profile.release]
4848
opt-level = 'z' # Optimize for size

rust/tests/BUILD.bazel

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@crates//:defs.bzl", "all_crate_deps")
2-
load("//rust:defs.bzl", "rust_test_suite", "rustfmt_config")
2+
load("//rust:defs.bzl", "rust_library", "rust_test_suite", "rustfmt_config")
33

44
rustfmt_config(
55
name = "enable-rustfmt",
@@ -10,15 +10,24 @@ rust_test_suite(
1010
size = "small",
1111
srcs = glob(["**/*_tests.rs"]),
1212
data = [
13-
"common.rs",
1413
"//rust:selenium-manager",
1514
],
1615
edition = "2021",
16+
rustc_env = {
17+
"CARGO_BIN_EXE_selenium-manager": "rust/selenium-manager",
18+
},
19+
shared_srcs = glob(
20+
["**/*.rs"],
21+
exclude = ["**/*_tests.rs"],
22+
),
1723
tags = [
1824
"no-sandbox",
1925
"requires-network",
2026
],
21-
deps = ["//rust:selenium_manager"] + all_crate_deps(
27+
deps = [
28+
"//rust:selenium_manager",
29+
"@rules_rust//tools/runfiles",
30+
] + all_crate_deps(
2231
package_name = "rust",
2332
normal = True,
2433
normal_dev = True,

rust/tests/common.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ use std::path::Path;
2828

2929
#[allow(dead_code)]
3030
pub fn get_selenium_manager() -> Command {
31-
Command::new(env!("CARGO_BIN_EXE_selenium-manager"))
31+
let path = env!("CARGO_BIN_EXE_selenium-manager");
32+
33+
if Path::new(path).exists() {
34+
return Command::new(path);
35+
}
36+
37+
panic!("Binary not found {}", path)
3238
}
3339

3440
#[allow(dead_code)]

0 commit comments

Comments
 (0)