Skip to content

Commit 84f264a

Browse files
committed
Run grid tests using Buck.
1 parent d4af5ec commit 84f264a

File tree

14 files changed

+117
-16
lines changed

14 files changed

+117
-16
lines changed

java/server/src/org/openqa/grid/BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ java_library(name = 'grid',
2929
],
3030
visibility = [
3131
'//java/server/src/org/openqa/grid/selenium:classes',
32+
'//java/server/test/org/openqa/grid/...',
3233
],
3334
)

java/server/src/org/openqa/grid/common/BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ java_library(name = 'common',
1212
visibility = [
1313
'//java/server/src/org/openqa/grid:grid',
1414
'//java/server/src/org/openqa/grid/selenium:classes',
15+
'//java/server/test/org/openqa/grid/...',
1516
],
1617
)

java/server/src/org/openqa/grid/selenium/BUCK

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ java_library(name = 'classes',
2020
'//third_party/java/gson:gson',
2121
'//third_party/java/servlet:servlet-api',
2222
],
23+
visibility = [
24+
'//java/server/test/org/openqa/grid/e2e:tests',
25+
],
2326
)

java/server/src/org/openqa/grid/web/servlet/handler/RequestHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ public void stop() {
260260
@Override
261261
public String toString() {
262262
StringBuilder b = new StringBuilder();
263-
b.append("session :").append(session).append(" , ");
263+
b.append("session:").append(session).append(", ");
264+
b.append("caps: ").append(request.getDesiredCapabilities());
264265
b.append("\n");
265266
return b.toString();
266267
}

java/server/test/org/openqa/grid/BUCK

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
SUITES = glob([
2+
'internal/**/*Tests.java',
3+
'plugin/**/*Tests.java',
4+
])
5+
6+
java_test(name = 'grid',
7+
srcs = SUITES,
8+
deps = [
9+
':test',
10+
'//java/server/src/org/openqa/grid:grid',
11+
'//java/server/src/org/openqa/grid/common:common',
12+
'//java/client/src/org/openqa/selenium/net:net',
13+
'//java/client/src/org/openqa/selenium/remote:capabilities',
14+
'//java/client/src/org/openqa/selenium/remote:remote',
15+
'//third_party/java/junit:junit',
16+
'//third_party/java/httpcomponents:httpclient',
17+
'//third_party/java/gson:gson',
18+
'//third_party/java/servlet:servlet-api',
19+
],
20+
)
21+
22+
java_library(name = 'test',
23+
srcs = glob([
24+
'internal/**/*.java',
25+
'plugin/**/*.java',
26+
], excludes = SUITES),
27+
resources = [
28+
'internal/configuration/grid_configuration_test1.yml',
29+
'internal/configuration/grid_configuration_test2.yml',
30+
],
31+
deps = [
32+
'//java/client/src/com/thoughtworks/selenium:selenium',
33+
'//java/server/src/org/openqa/grid:grid',
34+
'//java/server/src/org/openqa/grid/common:common',
35+
'//java/client/src/org/openqa/selenium:webdriver-api',
36+
'//java/client/src/org/openqa/selenium/remote:remote',
37+
'//third_party/java/gson:gson',
38+
'//third_party/java/junit:junit',
39+
'//third_party/java/mockito:mockito',
40+
'//third_party/java/servlet:servlet-api',
41+
],
42+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SUITES = glob(['*Tests.java'])
2+
3+
java_test(name = 'common',
4+
srcs = SUITES,
5+
deps = [
6+
':tests',
7+
'//third_party/java/junit:junit',
8+
],
9+
)
10+
11+
java_library(name = 'tests',
12+
srcs = glob(['*.java'], excludes = SUITES),
13+
deps = [
14+
'//java/client/src/org/openqa/selenium/remote:remote',
15+
'//java/server/src/org/openqa/grid/common:common',
16+
'//third_party/java/junit:junit',
17+
],
18+
)

java/server/test/org/openqa/grid/common/CommonTestSuite.java renamed to java/server/test/org/openqa/grid/common/CommonTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222

2323
@RunWith(Suite.class)
2424
@Suite.SuiteClasses(RegistrationRequestTest.class)
25-
public class CommonTestSuite {}
25+
public class CommonTests {}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
SUITES = glob(['**/*Tests.java'])
2+
3+
java_test(name = 'e2e',
4+
srcs = SUITES,
5+
deps = [
6+
':tests',
7+
'//third_party/java/junit:junit',
8+
],
9+
)
10+
11+
java_library(name = 'tests',
12+
srcs = glob(['**/*.java'], excludes = SUITES),
13+
deps = [
14+
'//java/client/src/com/thoughtworks/selenium:selenium',
15+
'//java/server/src/org/openqa/grid:grid',
16+
'//java/server/src/org/openqa/grid/common:common',
17+
'//java/server/src/org/openqa/grid/selenium:classes',
18+
'//java/client/src/org/openqa/selenium/chrome:chrome',
19+
'//java/client/src/org/openqa/selenium/firefox:firefox',
20+
'//java/client/src/org/openqa/selenium/net:net',
21+
'//java/client/src/org/openqa/selenium/remote:remote',
22+
'//java/client/src/org/openqa/selenium/support/ui:wait',
23+
'//third_party/java/guava-libraries:guava-libraries',
24+
'//third_party/java/httpcomponents:httpclient',
25+
'//third_party/java/junit:junit',
26+
'//third_party/java/mockito:mockito',
27+
'//third_party/java/servlet:servlet-api',
28+
],
29+
)

java/server/test/org/openqa/grid/e2e/GridE2ETests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@
6060
ExtraServletUtilTest.class,
6161
})
6262
public class GridE2ETests {
63-
6463
}

java/server/test/org/openqa/grid/internal/DefaultToFIFOPriorityTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void setup() throws InterruptedException {
6767
Map<String, Object> cap = new HashMap<>();
6868
cap.put(APP, "FF");
6969
cap.put("_priority", i);
70-
MockedRequestHandler req =GridHelper.createNewSessionHandler(registry, cap);
70+
MockedRequestHandler req = GridHelper.createNewSessionHandler(registry, cap);
7171
requests.add(req);
7272
}
7373

@@ -97,7 +97,8 @@ public void run() {
9797
}
9898

9999

100-
@Test
100+
// 20 second timeout in case we hang
101+
@Test(timeout = 20000)
101102
public void validateRequestAreHandledFIFO() throws InterruptedException {
102103
int cpt = 0;
103104
while (cpt < 8) {
@@ -116,6 +117,7 @@ public void validateRequestAreHandledFIFO() throws InterruptedException {
116117
@After
117118
public void teardown() {
118119
registry.stop();
120+
requests.clear(); // Because it's static
119121
}
120122

121123
}

0 commit comments

Comments
 (0)