forked from hardikk/h2o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_junit.py
88 lines (81 loc) · 3.52 KB
/
test_junit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import unittest, time, sys
import h2o
class TestJUnit(unittest.TestCase):
def test_A_fast_junit(self):
try:
h2o.build_cloud(node_count=2)
# we don't have the port or ip configuration here
# that util/h2o.py does? Keep this in synch with spawn_h2o there.
# also don't have --nosigar here?
(ps, stdout, stderr) = h2o.spawn_cmd('junit', [
'java',
'-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
'-Dh2o.arg.name='+h2o.cloud_name(),
'-Dh2o.arg.ip='+h2o.get_ip_address(),
'-ea', '-jar', h2o.find_file('target/h2o.jar'),
'-mainClass', 'org.junit.runner.JUnitCore',
# The tests
#'hex.GLMGridTest',
'hex.HistogramTest',
'hex.GLMTest',
'hex.KMeansTest',
'hex.MinorityClassTest',
'hex.rf.RandomForestTest',
'hex.rf.RFPredDomainTest',
'water.AtomicTest',
'water.AutoSerialTest',
'water.BitCmpTest',
#'water.ConcurrentKeyTest.java',
'water.KeyToString',
'water.KVTest',
#'water.KVSpeedTest',
'water.api.RStringTest',
'water.parser.DatasetCornerCasesTest',
'water.parser.ParseCompressedAndXLSTest',
'water.parser.ParseFolderTest',
'water.parser.ParseProgressTest',
'water.parser.ParserTest',
'water.parser.RReaderTest',
'water.score.ScorePmmlTest',
'water.score.ScoreTest'
])
rc = ps.wait(None)
out = file(stdout).read()
err = file(stderr).read()
if rc is None:
ps.terminate()
raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
elif rc != 0:
raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
finally:
h2o.tear_down_cloud()
def test_B_slow_junit(self):
h2o.tear_down_cloud()
h2o.build_cloud(node_count=2)
# we don't have the port or ip configuration here
# that util/h2o.py does? Keep this in synch with spawn_h2o there.
# also don't have --nosigar here?
(ps, stdout, stderr) = h2o.spawn_cmd('junit', [
'java',
'-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
'-Dh2o.arg.name='+h2o.cloud_name(),
'-Dh2o.arg.ip='+h2o.get_ip_address(),
'-ea', '-jar', h2o.find_file('target/h2o.jar'),
'-mainClass', 'org.junit.runner.JUnitCore',
# The tests
'water.ConcurrentKeyTest',
'hex.MinorityClassTest'
])
# getting UDP receiver stack traces if we shut down quickly after Junit
# may need to wait a little bit before shutdown?
time.sleep(3)
rc = ps.wait(None)
out = file(stdout).read()
err = file(stderr).read()
if rc is None:
ps.terminate()
raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
elif rc != 0:
raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
if __name__ == '__main__':
h2o.unit_main()