equal
deleted
inserted
replaced
36 |
36 |
37 def tearDownModule(): |
37 def tearDownModule(): |
38 stoppgcluster(__file__) |
38 stoppgcluster(__file__) |
39 |
39 |
40 |
40 |
|
41 class PostgresTimeoutConfiguration(PostgresApptestConfiguration): |
|
42 def __init__(self, *args, **kwargs): |
|
43 self.default_sources = PostgresApptestConfiguration.default_sources.copy() |
|
44 self.default_sources['system'] = PostgresApptestConfiguration.default_sources['system'].copy() |
|
45 self.default_sources['system']['db-statement-timeout'] = 200 |
|
46 super(PostgresTimeoutConfiguration, self).__init__(*args, **kwargs) |
|
47 |
|
48 |
41 class PostgresFTITC(CubicWebTC): |
49 class PostgresFTITC(CubicWebTC): |
42 configcls = PostgresApptestConfiguration |
50 configcls = PostgresTimeoutConfiguration |
43 |
51 |
44 def test_eid_range(self): |
52 def test_eid_range(self): |
45 # concurrent allocation of eid ranges |
53 # concurrent allocation of eid ranges |
46 source = self.session.repo.sources_by_uri['system'] |
54 source = self.session.repo.sources_by_uri['system'] |
47 range1 = [] |
55 range1 = [] |
132 {'type-subject': u'invalid value %(KEY-value)s, it must be one of %(KEY-choices)s'}) |
140 {'type-subject': u'invalid value %(KEY-value)s, it must be one of %(KEY-choices)s'}) |
133 self.assertEqual(cm.exception.msgargs, |
141 self.assertEqual(cm.exception.msgargs, |
134 {'type-subject-value': u'"nogood"', |
142 {'type-subject-value': u'"nogood"', |
135 'type-subject-choices': u'"todo", "a", "b", "T", "lalala"'}) |
143 'type-subject-choices': u'"todo", "a", "b", "T", "lalala"'}) |
136 |
144 |
|
145 def test_statement_timeout(self): |
|
146 with self.admin_access.repo_cnx() as cnx: |
|
147 cnx.system_sql('select pg_sleep(0.1)') |
|
148 with self.assertRaises(Exception): |
|
149 cnx.system_sql('select pg_sleep(0.3)') |
|
150 |
137 |
151 |
138 class PostgresLimitSizeTC(CubicWebTC): |
152 class PostgresLimitSizeTC(CubicWebTC): |
139 configcls = PostgresApptestConfiguration |
153 configcls = PostgresApptestConfiguration |
140 |
154 |
141 def test(self): |
155 def test(self): |