Skip to content

Commit

Permalink
[bazel] Fix UrlCheckerTest execution on macOS by breaking the sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed May 13, 2019
1 parent f1b8351 commit feecd7c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions java/client/test/org/openqa/selenium/net/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ java_library(
java_test_suite(
name = "SmallTests",
size = "small",
tags = [
"no-sandbox",
],
srcs = glob(["*Test.java"]),
deps = [
":net",
Expand Down
7 changes: 4 additions & 3 deletions java/client/test/org/openqa/selenium/net/UrlCheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class UrlCheckerTest {

private final UrlChecker urlChecker = new UrlChecker();
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
private JreAppServer server;
private URL url;

Expand All @@ -50,8 +51,6 @@ public void buildServer() throws MalformedURLException {
this.url = new URL(server.whereIs("/"));
}

ExecutorService executorService = Executors.newSingleThreadExecutor();

@Test
public void testWaitUntilAvailableIsTimely() throws Exception {
long delay = 200L;
Expand Down Expand Up @@ -88,7 +87,9 @@ public void testWaitUntilUnavailableIsTimely() throws Exception {

@After
public void cleanup() {
server.stop();
if (server != null) {
server.stop();
}
executorService.shutdown();
}
}
6 changes: 4 additions & 2 deletions java/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def java_test_suite(
resources=None,
deps=None,
visibility=None,
size = None):
size = None,
tags = []):

# By default bazel computes the name of test classes based on the
# standard Maven directory structure, which we don't use in
Expand Down Expand Up @@ -90,12 +91,13 @@ def java_test_suite(
size = size,
test_class = test_class,
resources = resources,
tags = tags,
deps = deps,
visibility = ["//visibility:private"])

native.test_suite(
name = name,
tests = tests,
tags = ["manual"],
tags = ["manual"] + tags,
visibility = visibility)

0 comments on commit feecd7c

Please sign in to comment.