Skip to content

Commit

Permalink
Merge pull request #15 from OferMania/timeout
Browse files Browse the repository at this point in the history
Enforces 10-minute timeout limit per test.
  • Loading branch information
OferMania authored Sep 10, 2019
2 parents cef37dd + 7136623 commit dbffa0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pyexpect = "*"
grpcio = "*"
grpcio-tools = "*"
kazoo = "*"
timeout-decorator = "*"

[requires]
python_version = "2.7"
9 changes: 8 additions & 1 deletion config/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions testing/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import Table_pb2
import unittest
from pyexpect import expect
from timeout_decorator import timeout
import cluster_test_utils as ctu

ten_minutes = 600 # number of seconds in 10 minutes

class TestCluster(unittest.TestCase):
def setUp(self):
self.ramcloud_network = ctu.make_docker_network('ramcloud-net', '10.0.0.0/16')
Expand Down Expand Up @@ -57,6 +60,7 @@ def simple_recovery(self, kill_command):
value = self.rc_client.read(self.table, 'testKey')
expect(value).equals(('testValue', 1))

@timeout(ten_minutes)
def test_zookeeper_read(self):
self.make_cluster(num_nodes=4)
self.createTestValue()
Expand All @@ -71,6 +75,7 @@ def test_zookeeper_read(self):
expect(table_parsed.id).equals(1L)
expect(table_parsed.name).equals("test")

@timeout(ten_minutes)
def test_read_write(self):
self.make_cluster(num_nodes=3)
self.rc_client.create_table('test_table')
Expand All @@ -80,6 +85,7 @@ def test_read_write(self):

expect(value).equals('Hello, World!')

@timeout(ten_minutes)
def test_two_writes(self):
self.make_cluster(num_nodes=4)
self.rc_client.create_table('test_table')
Expand All @@ -91,9 +97,11 @@ def test_two_writes(self):

expect(value).equals('Good weather')

@timeout(ten_minutes)
def test_01_simple_recovery_graceful_server_down(self):
self.simple_recovery(kill_command = 'killall -SIGTERM rc-server')

@timeout(ten_minutes)
def test_01_simple_recovery_forced_server_down(self):
self.simple_recovery(kill_command = 'killall -SIGKILL rc-server')

Expand Down

0 comments on commit dbffa0b

Please sign in to comment.