Merge lp:~rvb/maas/bug-1013275 into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 645
Proposed branch: lp:~rvb/maas/bug-1013275
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 41 lines (+3/-6)
3 files modified
src/maasserver/tests/test_preseed.py (+1/-1)
src/maasserver/tests/test_views_nodes.py (+1/-4)
templates/test_module.py (+1/-1)
To merge this branch: bzr merge lp:~rvb/maas/bug-1013275
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+110475@code.launchpad.net

Commit message

Fix test_node_list_displays_sorted_list_of_nodes spurious failure.

Description of the change

This branch fixes bug 1013275. I've used the wrong test case in test_preseed.py and the database wasn't cleared at the end of the test. D'oh!

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

How I hate these failures! There ought to be something we can do to prevent this. Maybe we can start by changing templates/test_module.py so that it no longer suggests maastesting.testcase by default.

Jeroen

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> How I hate these failures! There ought to be something we can do to prevent
> this. Maybe we can start by changing templates/test_module.py so that it no
> longer suggests maastesting.testcase by default.

I've updated the template, we use the DB in tests most of the times so it seems more logical to propose using maasserver.testing.testcase by default.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Friday 15 June 2012 07:17:31 you wrote:
> Review: Approve
>
> How I hate these failures! There ought to be something we can do to prevent
> this. Maybe we can start by changing templates/test_module.py so that it
> no longer suggests maastesting.testcase by default.
>
>
> Jeroen

I have 2 more suggestions:

 1. Rename the test cases so that they are not all TestCase. Make their names
mean something.
 2. Make the non-DB test cases cause failures immediately if you try to access
the DB.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/tests/test_preseed.py'
2--- src/maasserver/tests/test_preseed.py 2012-06-14 16:17:27 +0000
3+++ src/maasserver/tests/test_preseed.py 2012-06-15 07:23:21 +0000
4@@ -17,7 +17,7 @@
5 split_subarch,
6 )
7 from maasserver.testing.factory import factory
8-from maastesting.testcase import TestCase
9+from maasserver.testing.testcase import TestCase
10
11
12 class TestPreseedUtilities(TestCase):
13
14=== modified file 'src/maasserver/tests/test_views_nodes.py'
15--- src/maasserver/tests/test_views_nodes.py 2012-06-14 17:05:59 +0000
16+++ src/maasserver/tests/test_views_nodes.py 2012-06-15 07:23:21 +0000
17@@ -65,10 +65,7 @@
18 node_link = reverse('node-view', args=[node.system_id])
19 self.assertIn(node_link, get_content_links(response))
20
21- # XXX rvb 2012-06-14 bug=1013275 I've disabled this test temporarily.
22- # There is an isolation problem here as this test is picking up 5
23- # nodes from the database and only 3 nodes are created.
24- def disabled_node_list_displays_sorted_list_of_nodes(self):
25+ def test_node_list_displays_sorted_list_of_nodes(self):
26 # Nodes are sorted on the node list page, newest first.
27 nodes = [factory.make_node() for i in range(3)]
28 # Explicitely set node.created since all of these node will
29
30=== modified file 'templates/test_module.py'
31--- templates/test_module.py 2012-04-16 10:00:51 +0000
32+++ templates/test_module.py 2012-06-15 07:23:21 +0000
33@@ -12,7 +12,7 @@
34 __metaclass__ = type
35 __all__ = []
36
37-from maastesting.testcase import TestCase
38+from maasserver.testing.testcase import TestCase
39
40
41 class TestSomething(TestCase):