~launchpad-pqm/launchpad/devel

14027.3.1 by Jeroen Vermeulen
Fix lots of lint in recently-changed files.
1
Closing Bugs when Publishing Accepted Source
2
============================================
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
3
4
We have implemented 'premature publication of accepted sources' in
3691.312.42 by Celso Providelo
typos ...
5
NascentUpload to increase the publishing throughput (see
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
6
launchpad/doc/nascentupload.txt).
7
3691.312.42 by Celso Providelo
typos ...
8
Therefore we also use the available infrastructure to close bugs
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
9
mentioned in the source changelog (see close-bugs-from-changelog).
10
11
Starting a new series of package, upload and publish the first version
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
12
of 'bar' source package in ubuntu/hoary.
13
14
14027.3.1 by Jeroen Vermeulen
Fix lots of lint in recently-changed files.
15
Publishing package and creating a bugtask
16
-----------------------------------------
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
17
18
    >>> bar_src = getUploadForSource(
14027.3.1 by Jeroen Vermeulen
Fix lots of lint in recently-changed files.
19
    ...	    'suite/bar_1.0-1/bar_1.0-1_source.changes')
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
20
    >>> bar_src.process()
21
    >>> result = bar_src.do_accept()
22
    >>> bar_src.queue_root.status.name
23
    'NEW'
24
25
    >>> bar_src.queue_root.setAccepted()
5663.3.6 by Celso Providelo
applying review comments, r=sinzui.
26
    >>> pub_records = bar_src.queue_root.realiseUpload()
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
27
14606.3.1 by William Grant
Merge canonical.database into lp.services.database.
28
    >>> from lp.services.database.sqlbase import commit
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
29
    >>> commit()
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
30
31
Check the current status of the bug we are supposed to fix:
32
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
33
    >>> the_bug_id = 6
34
14604.1.1 by Curtis Hovey
Separate test-authoring classes from test-running classes.
35
    >>> from lp.testing.layers import LaunchpadZopelessLayer
11692.6.2 by Curtis Hovey
Use deglober to fixing simple glob imports in doctests.
36
    >>> from lp.bugs.interfaces.bug import IBugSet
11716.1.6 by Curtis Hovey
Converted glob imports in doctests to import for the true module.
37
    >>> from lp.bugs.interfaces.bugtask import IBugTaskSet
38
    >>> from lp.registry.interfaces.distribution import IDistributionSet
39
    >>> from lp.registry.interfaces.person import IPersonSet
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
40
    >>> login('no-priv@canonical.com')
41
    >>> LaunchpadZopelessLayer.switchDbUser('launchpad')
42
43
    >>> bugtask_owner = getUtility(IPersonSet).getByName('kinnison')
44
    >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
45
    >>> ubuntu_bar = ubuntu.getSourcePackage('bar')
46
47
    >>> the_bug = getUtility(IBugSet).get(the_bug_id)
48
    >>> bugtask = getUtility(IBugTaskSet).createTask(
13571.2.2 by William Grant
BugTaskSet.createTask now takes an IBugTarget, not a key. Blergh.
49
    ...     the_bug, bugtask_owner, ubuntu_bar)
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
50
51
Inspect the current bugtasks for bug #6:
52
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
53
    >>> for bugtask in the_bug.bugtasks:
14027.3.1 by Jeroen Vermeulen
Fix lots of lint in recently-changed files.
54
    ...     print bugtask.title
55
    ...     print bugtask.status.name
4002.7.57 by Matthew Paul Thomas
Fixes functional tests.
56
    Bug #6 in Mozilla Firefox: "Firefox crashes when ...
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
57
    NEW
58
    Bug #6 in bar (Ubuntu): "Firefox crashes when ...
59
    NEW
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
60
61
Return to the original test environment:
62
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
63
    >>> commit()
14605.1.1 by Curtis Hovey
Moved canonical.config to lp.services.
64
    >>> from lp.services.config import config
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
65
    >>> LaunchpadZopelessLayer.switchDbUser(config.uploader.dbuser)
66
    >>> login('foo.bar@canonical.com')
67
68
14027.3.1 by Jeroen Vermeulen
Fix lots of lint in recently-changed files.
69
Testing bug closing
70
-------------------
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
71
72
Once the base source is published every posterior version will be
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
73
automatically published in upload time as described in
74
nascentupload-publishing-accepted-sources.txt.
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
75
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
76
    >>> bar2_src = getUploadForSource(
77
    ...     'suite/bar_1.0-2/bar_1.0-2_source.changes')
78
    >>> bar2_src.process()
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
79
80
This new version fixes bug #6 according its changesfiles:
81
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
82
    >>> bar2_src.changes.changed_by['person'].name
83
    u'kinnison'
84
7675.787.15 by Jelmer Vernooij
When parsing DSC control files, use case insensitive lookups
85
    >>> bar2_src.changes._dict['Launchpad-bugs-fixed']
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
86
    '6'
87
88
    >>> print bar2_src.changes.changes_comment
89
    bar (1.0-2) breezy; urgency=low
90
    <BLANKLINE>
91
      * A second upload to ensure that binary overrides of _all work
6792.1.38 by Muharem Hrnjadovic
another failed test fixed
92
    <BLANKLINE>
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
93
      * Also closes Launchpad bug #6
94
    <BLANKLINE>
95
    <BLANKLINE>
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
96
97
Do the upload acceptance/publication and expect the bug mentioned to
98
be processed:
99
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
100
    >>> result = bar2_src.do_accept()
101
    >>> bar2_src.queue_root.status.name
102
    'DONE'
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
103
104
Checking the results, the bugtask for 'bar (Ubuntu)' is updated to
105
FIXRELEASED and bug notification are generated:
106
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
107
    >>> the_bug = getUtility(IBugSet).get(6)
108
109
    >>> for bugtask in the_bug.bugtasks:
14027.3.1 by Jeroen Vermeulen
Fix lots of lint in recently-changed files.
110
    ...     print bugtask.title
111
    ...     print bugtask.status.name
4002.7.57 by Matthew Paul Thomas
Fixes functional tests.
112
    Bug #6 in Mozilla Firefox: "Firefox crashes when ...
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
113
    NEW
114
    Bug #6 in bar (Ubuntu): "Firefox crashes when ...
115
    FIXRELEASED
116
11626.3.12 by Curtis Hovey
Cross fingers and toes and hope for the best--remove all glob imports of bugs from
117
    >>> from lp.bugs.model.bugnotification import BugNotification
4682.1.15 by Christian Reis
Fix tests that break when you add new bugs to sampledata
118
    >>> notifications = BugNotification.selectBy(bug=the_bug, orderBy='id')
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
119
    >>> for notification in notifications:
120
    ...     print "From %s:\n%s\n" % (
121
    ...         notification.message.owner.displayname,
122
    ...         notification.message.text_contents)
5267.3.8 by Tom Berger
ajust a forgotten archiver test
123
    From Launchpad Janitor:
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
124
    ** Changed in: bar (Ubuntu)
125
           Status: New => Fix Released
126
    <BLANKLINE>
5267.3.8 by Tom Berger
ajust a forgotten archiver test
127
    From Launchpad Janitor:
128
    This bug was fixed in the package bar - 1.0-2
129
    <BLANKLINE>
130
    ---------------
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
131
    bar (1.0-2) breezy; urgency=low
132
    <BLANKLINE>
133
      * A second upload to ensure that binary overrides of _all work
6792.1.38 by Muharem Hrnjadovic
another failed test fixed
134
    <BLANKLINE>
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
135
      * Also closes Launchpad bug #6
136
    <BLANKLINE>
137
    <BLANKLINE>
138
     -- Daniel Silverstone <daniel.silverstone@canonical.com>   Thu, 30 Mar 2006 01:36:14 +0100
5267.3.8 by Tom Berger
ajust a forgotten archiver test
139
    <BLANKLINE>
3691.312.41 by Celso Providelo
moving closing-bugs tests from launchpad/doc/nascentupload.txt to archiveuploader/ftests/nascentupload-closing-bugs.txt.
140
13747.1.2 by Steve Kowalik
Clean up bar_1.0-2 orig tarball madness.
141
And clean up.
142
143
    >>> import os
144
    >>> from lp.archiveuploader.tests import datadir
145
    >>> upload_data = datadir('suite/bar_1.0-2')
146
    >>> os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))