Skip to content

Commit cd9c706

Browse files
committed
[docker] Fix existing docker functionality
1 parent d2dc677 commit cd9c706

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

java/client/src/org/openqa/selenium/remote/http/HttpResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public class HttpResponse extends HttpMessage<HttpResponse> {
2626

2727
private int status = HTTP_OK;
2828

29+
public boolean isSuccessful() {
30+
return getStatus() >= HTTP_OK && getStatus() < 300;
31+
}
32+
2933
public int getStatus() {
3034
return status;
3135
}

java/server/src/org/openqa/selenium/docker/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ java_library(
33
srcs = glob(["*.java"]),
44
visibility = [
55
"//java/server/src/org/openqa/selenium/grid/docker:__pkg__",
6+
"//java/server/test/org/openqa/selenium:__subpackages__",
67
],
78
deps = [
89
"//java/client/src/org/openqa/selenium/json",

java/server/src/org/openqa/selenium/docker/Container.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ContainerId getId() {
5050
public void start() {
5151
LOG.info("Starting " + getId());
5252
HttpResponse res = client.execute(new HttpRequest(POST, String.format("/containers/%s/start", id)));
53-
if (res.getStatus() != HTTP_OK) {
53+
if (!res.isSuccessful()) {
5454
throw new WebDriverException("Unable to start container: " + Contents.string(res));
5555
}
5656
}
@@ -66,7 +66,7 @@ public void stop(Duration timeout) {
6666
.addQueryParameter("t", seconds);
6767

6868
HttpResponse res = client.execute(request);
69-
if (res.getStatus() != HTTP_OK) {
69+
if (!res.isSuccessful()) {
7070
throw new WebDriverException("Unable to stop container: " + Contents.string(res));
7171
}
7272
}

java/server/src/org/openqa/selenium/grid/commands/Standalone.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
@AutoService(CliCommand.class)
6060
public class Standalone implements CliCommand {
6161

62-
public static final Logger LOG = Logger.getLogger("selenium");
62+
private static final Logger LOG = Logger.getLogger("selenium");
6363

6464
@Override
6565
public String getName() {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
load("//java:defs.bzl", "java_test_suite")
4+
5+
java_test_suite(
6+
name = "MediumTests",
7+
size = "medium",
8+
srcs = glob(["*.java"]),
9+
tags = [
10+
"manual",
11+
],
12+
deps = [
13+
"//java/client/src/org/openqa/selenium/remote",
14+
"//java/server/src/org/openqa/selenium/docker",
15+
"//third_party/java/junit",
16+
],
17+
)

0 commit comments

Comments
 (0)