7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
1 |
Submissions to the hardware database |
2 |
==================================== |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
3 |
|
4 |
The hardware database client collects information from various sources, |
|
5 |
and submits it in an HTTP POST request to the hardware database server. |
|
6 |
The POST data consists of the following fields: |
|
7 |
||
8 |
* date_created (see hwdb.txt) |
|
9 |
* format (see hwdb.txt) |
|
10 |
* private (see hwdb.txt) |
|
11 |
* contactable (see hwdb.txt) |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
12 |
* submission_key (see hwdb.txt) |
4675.3.1
by Abel Deuring
HWDB data upload form added |
13 |
* emailaddress (see hwdb.txt) |
14 |
* distribution: The distribution name. The value should match a value |
|
15 |
in the SQL table Distribution, column name. |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
16 |
* distroseries: The distroseries version. The value should match a value |
17 |
in the SQL table distroseries, column version |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
18 |
* processorfamily: The name of the processorfamily. The value should |
4675.3.1
by Abel Deuring
HWDB data upload form added |
19 |
match a value in the SQL table Processorfamily, column name. |
20 |
* system: The system name as returned by HAL (system.vendor, system.product) |
|
21 |
* submission_data: An XML file containing the collected data. This file is |
|
22 |
simply stored as a Librarian file, and parsed later by a cron job. |
|
23 |
||
11716.1.12
by Curtis Hovey
Sorted imports in doctests. |
24 |
>>> from zope.component import getUtility |
4675.3.1
by Abel Deuring
HWDB data upload form added |
25 |
>>> from StringIO import StringIO |
10234.3.3
by Curtis Hovey
Migrated hardward database to lp. Updated test_doc to run the hwddb test. |
26 |
>>> from lp.hardwaredb.interfaces.hwdb import IHWDBApplication |
4675.3.1
by Abel Deuring
HWDB data upload form added |
27 |
>>> data = StringIO('some data.') |
28 |
>>> data.filename = 'hardware-info' |
|
29 |
>>> form={'field.date_created': u'2007-08-01', |
|
30 |
... 'field.format': u'VERSION_1', |
|
31 |
... 'field.private': u'', |
|
32 |
... 'field.contactable': u'', |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
33 |
... 'field.submission_key': u'unique-id-1', |
4675.3.1
by Abel Deuring
HWDB data upload form added |
34 |
... 'field.emailaddress': u'test@canonical.com', |
35 |
... 'field.distribution': u'ubuntu', |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
36 |
... 'field.distroseries': u'5.04', |
4675.3.1
by Abel Deuring
HWDB data upload form added |
37 |
... 'field.architecture': u'i386', |
38 |
... 'field.system': u'HP 6543', |
|
39 |
... 'field.submission_data': data, |
|
40 |
... 'field.actions.upload': u'Upload'} |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
41 |
|
4675.3.2
by Abel Deuring
added views for hwdb submissiions from a person and submissions for a fingerprint |
42 |
>>> app = getUtility(IHWDBApplication) |
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
43 |
>>> submit_view = create_initialized_view(app, name='+submit', form=form) |
4675.3.1
by Abel Deuring
HWDB data upload form added |
44 |
>>> submit_view.errors |
45 |
[] |
|
46 |
||
47 |
The request created an entry in the HWDBSubmissions table. |
|
48 |
||
11692.6.2
by Curtis Hovey
Use deglober to fixing simple glob imports in doctests. |
49 |
>>> from lp.hardwaredb.interfaces.hwdb import IHWSubmissionSet |
4675.2.5
by Abel Deuring
fixed pagetests for HWDB submissions |
50 |
>>> submission_set = getUtility(IHWSubmissionSet) |
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
51 |
>>> submission = submission_set.getBySubmissionKey(u'unique-id-1') |
4675.3.1
by Abel Deuring
HWDB data upload form added |
52 |
>>> submission.date_created, submission.format.name |
53 |
(datetime.datetime(2007, 8, 1, 0, 0, tzinfo=<UTC>), 'VERSION_1') |
|
4675.2.5
by Abel Deuring
fixed pagetests for HWDB submissions |
54 |
>>> submission.private, submission.contactable |
55 |
(False, False) |
|
56 |
>>> submission.submission_key |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
57 |
u'unique-id-1' |
4675.2.5
by Abel Deuring
fixed pagetests for HWDB submissions |
58 |
>>> submission.system_fingerprint.fingerprint |
4675.3.1
by Abel Deuring
HWDB data upload form added |
59 |
u'HP 6543' |
60 |
||
61 |
The submitted data is stored in raw_submission. |
|
62 |
||
63 |
>>> import transaction |
|
64 |
>>> transaction.commit() |
|
65 |
>>> submission.raw_submission.read() |
|
66 |
'some data.' |
|
67 |
||
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
68 |
A reference to distroarchseries is created for the fields distribution, |
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
69 |
distroseries, architecture. |
4675.3.1
by Abel Deuring
HWDB data upload form added |
70 |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
71 |
>>> submission.distroarchseries.distroseries.distribution.name |
4675.3.1
by Abel Deuring
HWDB data upload form added |
72 |
u'ubuntu' |
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
73 |
>>> submission.distroarchseries.distroseries.version |
4675.3.1
by Abel Deuring
HWDB data upload form added |
74 |
u'5.04' |
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
75 |
>>> submission.distroarchseries.architecturetag |
4675.3.1
by Abel Deuring
HWDB data upload form added |
76 |
u'i386' |
77 |
||
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
78 |
Each submission must have a distinct submission_key, hence an attempt to submit |
4675.3.1
by Abel Deuring
HWDB data upload form added |
79 |
identical data a second time leads to an error. |
80 |
||
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
81 |
>>> submit_view = create_initialized_view(app, name='+submit', form=form) |
82 |
>>> for error in submit_view.errors: |
|
83 |
... print error.doc() |
|
84 |
Submission key already exists. |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
85 |
|
86 |
If the field distribution contains a name which is not known in the |
|
87 |
Launchpad database, the distroarchseries field is None. |
|
88 |
||
89 |
>>> form['field.submission_key'] = u'unique-id-2' |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
90 |
>>> invalid_form = form.copy() |
91 |
>>> invalid_form['field.distribution'] = 'no distribution' |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
92 |
>>> submit_view = create_initialized_view( |
93 |
... app, name='+submit', form=invalid_form) |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
94 |
>>> submission = submission_set.getBySubmissionKey(u'unique-id-2') |
95 |
>>> print submission.distroarchseries |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
96 |
None |
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
97 |
|
98 |
If distribution is known, but distroseries or architecture are unknown |
|
99 |
to Launchpad, we refuse the submissions. |
|
100 |
||
101 |
>>> form['field.submission_key'] = u'unique-id-3' |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
102 |
>>> invalid_form = form.copy() |
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
103 |
>>> invalid_form['field.distroseries'] = 'no release' |
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
104 |
>>> submit_view = create_initialized_view( |
105 |
... app, name='+submit', form=invalid_form) |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
106 |
>>> print submission_set.getBySubmissionKey(u'unique-id-3') |
4675.3.1
by Abel Deuring
HWDB data upload form added |
107 |
None |
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
108 |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
109 |
>>> form['field.submission_key'] = u'unique-id-4' |
4675.3.1
by Abel Deuring
HWDB data upload form added |
110 |
>>> invalid_form = form.copy() |
111 |
>>> invalid_form['field.architecture'] = 'no architecture' |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
112 |
>>> submit_view = create_initialized_view( |
113 |
... app, name='+submit', form=invalid_form) |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
114 |
>>> print submission_set.getBySubmissionKey(u'unique-id-4') |
4675.3.1
by Abel Deuring
HWDB data upload form added |
115 |
None |
116 |
||
117 |
The `date_created` field must contain a valid date. |
|
118 |
||
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
119 |
>>> form['field.submission_key'] = u'unique-id-5' |
4675.3.1
by Abel Deuring
HWDB data upload form added |
120 |
>>> invalid_form = form.copy() |
121 |
>>> invalid_form['field.date_created'] = '2007-05-35' |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
122 |
>>> submit_view = create_initialized_view( |
123 |
... app, name='+submit', form=invalid_form) |
|
124 |
>>> for error in submit_view.errors: |
|
125 |
... print error.doc() |
|
126 |
Invalid datetime data |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
127 |
|
128 |
The `format` field must contain a value that matches the DBEnumeratedType |
|
129 |
HWDBSubmissionFormat. |
|
130 |
||
131 |
>>> invalid_form = form.copy() |
|
132 |
>>> invalid_form['field.format'] = u'VERSION_42' |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
133 |
>>> submit_view = create_initialized_view( |
134 |
... app, name='+submit', form=invalid_form) |
|
135 |
>>> for error in submit_view.errors: |
|
136 |
... print error.doc() |
|
137 |
Invalid value |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
138 |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
139 |
The field `submission_key` may contain only ASCII data. |
4675.3.1
by Abel Deuring
HWDB data upload form added |
140 |
|
141 |
>>> invalid_form = form.copy() |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
142 |
>>> invalid_form['field.submission_key'] = u'wrong id \x81' |
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
143 |
>>> submit_view = create_initialized_view( |
144 |
... app, name='+submit', form=invalid_form) |
|
145 |
>>> for error in submit_view.errors: |
|
146 |
... print error.doc() |
|
147 |
Invalid textual data |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
148 |
|
4974.3.2
by Abel Deuring
No automatic creation of Person records for HWDB from unknown email addresses |
149 |
The field `emailaddress` must contain a formally valid email address. |
150 |
||
151 |
>>> invalid_form = form.copy() |
|
152 |
>>> invalid_form['field.emailaddress'] = u'beeblebrox' |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
153 |
>>> submit_view = create_initialized_view( |
154 |
... app, name='+submit', form=invalid_form) |
|
155 |
>>> for error in submit_view.errors: |
|
156 |
... print error.doc() |
|
157 |
Invalid email address |
|
158 |
||
159 |
All fields are required. With normal form processing, it's impossible not to |
|
160 |
have values for field.format, field.private, or field.contactable because |
|
161 |
those widgets are checkboxes and menus. |
|
162 |
||
163 |
>>> for field in ( |
|
164 |
... 'field.date_created', 'field.submission_key', |
|
5653.2.6
by Maris Fogels
Fixed a number of broken pagetests. |
165 |
... 'field.emailaddress', 'field.distribution', |
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
166 |
... 'field.distroseries', 'field.architecture', |
167 |
... 'field.system', 'field.submission_data', |
|
168 |
... ): |
|
4675.3.1
by Abel Deuring
HWDB data upload form added |
169 |
... invalid_form = form.copy() |
170 |
... del invalid_form[field] |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
171 |
... invalid_form[field] = u'' |
172 |
... submit_view = create_initialized_view( |
|
173 |
... app, name='+submit', form=invalid_form) |
|
174 |
... print field |
|
175 |
... for error in submit_view.errors: |
|
176 |
... field_name = error.field_name |
|
177 |
... print ' ', field_name, submit_view.getFieldError(field_name) |
|
178 |
field.date_created |
|
179 |
date_created Required input is missing. |
|
180 |
field.submission_key |
|
181 |
submission_key Required input is missing. |
|
182 |
field.emailaddress |
|
183 |
emailaddress Required input is missing. |
|
184 |
field.distribution |
|
185 |
distribution Required input is missing. |
|
186 |
field.distroseries |
|
187 |
distroseries Required input is missing. |
|
188 |
field.architecture |
|
189 |
architecture Required input is missing. |
|
190 |
field.system |
|
191 |
system Required input is missing. |
|
192 |
field.submission_data |
|
193 |
submission_data Required input is missing. |
|
4675.5.1
by Abel Deuring
allow team ownership of HWDB submissions |
194 |
|
195 |
Teams can be owners of submissions. |
|
196 |
||
6978.2.11
by Abel Deuring
added a test for the cronscript |
197 |
>>> import os |
14605.1.1
by Curtis Hovey
Moved canonical.config to lp.services. |
198 |
>>> from lp.services.config import config |
4675.5.1
by Abel Deuring
allow team ownership of HWDB submissions |
199 |
>>> team_form = form.copy() |
200 |
>>> team_form['field.emailaddress'] = 'support@ubuntu.com' |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
201 |
>>> team_form['field.submission_key'] = u'unique-id-68' |
6978.2.11
by Abel Deuring
added a test for the cronscript |
202 |
>>> valid_sample_data_path = os.path.join( |
203 |
... config.root, |
|
14455.3.5
by William Grant
Move more hwdb tests to hwdb. |
204 |
... 'lib/lp/hardwaredb/scripts/tests/' |
6978.2.11
by Abel Deuring
added a test for the cronscript |
205 |
... 'simple_valid_hwdb_submission.xml') |
206 |
>>> valid_sample_data = StringIO(open(valid_sample_data_path).read()) |
|
207 |
>>> valid_sample_data.filename = 'simple_valid_hwdb_submission.xml' |
|
208 |
>>> team_form['field.submission_data'] = valid_sample_data |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
209 |
>>> submit_view = create_initialized_view( |
210 |
... app, name='+submit', form=team_form) |
|
4912.1.3
by Christian Reis
Implement the plain-text view for HWDB submissions, check that submission IDs are really valid_names, rename submission_id to submission_key consistently, rename distro*release to distro*series consistently. What else.. |
211 |
>>> submission = submission_set.getBySubmissionKey(u'unique-id-68') |
4675.5.1
by Abel Deuring
allow team ownership of HWDB submissions |
212 |
>>> submission.owner.displayname |
213 |
u'Ubuntu Team' |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
214 |
|
6978.2.12
by Abel Deuring
added a docstring for the cronscript |
215 |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
216 |
Submission Processing |
217 |
--------------------- |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
218 |
|
219 |
Submissions are processed by the cronscript process-hwdb-submissions.py. |
|
220 |
This script processes all submissions with the status SUBMITTED, checks |
|
221 |
the validity of each submission, populates the HWDB tables with data |
|
222 |
from a submission and sets the submission state to VALID. If any error |
|
223 |
occurs when a submission is processed, its status is set to INVALID and |
|
224 |
according error is logged. For details, see |
|
10234.3.3
by Curtis Hovey
Migrated hardward database to lp. Updated test_doc to run the hwddb test. |
225 |
lp/hardwaredb/scripts/tests/test_hwdb_submission_processing.py. |
6978.2.11
by Abel Deuring
added a test for the cronscript |
226 |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
227 |
We have currently three unprocessed submissions in the database, one |
228 |
submission with the status PROCESSED and no submissions with the status |
|
229 |
INVALID. |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
230 |
|
10234.3.3
by Curtis Hovey
Migrated hardward database to lp. Updated test_doc to run the hwddb test. |
231 |
>>> from lp.hardwaredb.interfaces.hwdb import ( |
6978.2.11
by Abel Deuring
added a test for the cronscript |
232 |
... HWSubmissionProcessingStatus) |
233 |
>>> new_submissions = submission_set.getByStatus( |
|
234 |
... HWSubmissionProcessingStatus.SUBMITTED) |
|
235 |
>>> for submission in new_submissions: |
|
236 |
... print submission.submission_key, submission.status.title |
|
237 |
test_submission_id_1 Submitted |
|
238 |
unique-id-1 Submitted |
|
239 |
unique-id-68 Submitted |
|
240 |
>>> processed_submissions = submission_set.getByStatus( |
|
241 |
... HWSubmissionProcessingStatus.PROCESSED) |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
242 |
>>> for submission in processed_submissions: |
243 |
... print submission.submission_key, submission.status.title |
|
244 |
sample-submission Processed |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
245 |
>>> invalid_submissions = submission_set.getByStatus( |
246 |
... HWSubmissionProcessingStatus.INVALID) |
|
6978.2.12
by Abel Deuring
added a docstring for the cronscript |
247 |
>>> print invalid_submissions.count() |
6978.2.11
by Abel Deuring
added a test for the cronscript |
248 |
0 |
249 |
||
250 |
The script process-hwdb-submissions.py takes the optional parameter |
|
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
251 |
-m or --max-submissions, so let's process just the first of these three |
7881.6.7
by Abel Deuring
fixed a test failure caused by the new treatment of Librarian inconsistencies |
252 |
submissions. We don't have a Librarian file for this submission, so |
253 |
let's add one. Let's add invalid data in order to see how invalid |
|
254 |
submissions are processed. |
|
255 |
||
14606.2.5
by William Grant
Move the rest of canonical.librarian to lp.services.librarianserver. |
256 |
>>> from lp.services.librarianserver.testing.server import fillLibrarianFile |
7881.6.7
by Abel Deuring
fixed a test failure caused by the new treatment of Librarian inconsistencies |
257 |
>>> submission = submission_set.getBySubmissionKey('test_submission_id_1') |
258 |
>>> fillLibrarianFile( |
|
259 |
... submission.raw_submission.id, 'nonsense') |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
260 |
|
261 |
# Commit the current transaction so that the script sees the |
|
262 |
# recently added data. |
|
263 |
>>> import transaction |
|
264 |
>>> transaction.commit() |
|
265 |
||
266 |
# Run the script. |
|
14593.2.5
by Curtis Hovey
Moved script to lp.testing. |
267 |
>>> from lp.testing.script import run_script |
7123.1.2
by Abel Deuring
implemented reviewer's comments |
268 |
>>> returnvalue, out, err = run_script( |
269 |
... 'cronscripts/process-hwdb-submissions.py', ['-m1']) |
|
270 |
>>> returnvalue |
|
271 |
0 |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
272 |
>>> print err |
7675.624.72
by Tim Penhey
Gee there are a lot of these lockfile creation fixes. |
273 |
INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock |
7881.6.7
by Abel Deuring
fixed a test failure caused by the new treatment of Librarian inconsistencies |
274 |
ERROR Parsing submission test_submission_id_1: syntax error: |
275 |
line 1, column 0 |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
276 |
INFO Processed 0 valid and 1 invalid HWDB submissions |
7881.6.7
by Abel Deuring
fixed a test failure caused by the new treatment of Librarian inconsistencies |
277 |
<BLANKLINE> |
6978.2.11
by Abel Deuring
added a test for the cronscript |
278 |
>>> print out |
279 |
<BLANKLINE> |
|
280 |
||
281 |
Submission "test_submission_id_1" has now the state INVALID; the other |
|
282 |
submissions are unchanged. |
|
283 |
||
284 |
>>> new_submissions = submission_set.getByStatus( |
|
285 |
... HWSubmissionProcessingStatus.SUBMITTED) |
|
286 |
>>> for submission in new_submissions: |
|
287 |
... print submission.submission_key, submission.status.title |
|
288 |
unique-id-1 Submitted |
|
289 |
unique-id-68 Submitted |
|
290 |
>>> processed_submissions = submission_set.getByStatus( |
|
291 |
... HWSubmissionProcessingStatus.PROCESSED) |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
292 |
>>> for submission in processed_submissions: |
293 |
... print submission.submission_key, submission.status.title |
|
294 |
sample-submission Processed |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
295 |
>>> invalid_submissions = submission_set.getByStatus( |
296 |
... HWSubmissionProcessingStatus.INVALID) |
|
297 |
>>> for submission in invalid_submissions: |
|
298 |
... print submission.submission_key, submission.status.title |
|
299 |
test_submission_id_1 Invalid submission |
|
300 |
||
301 |
From the remaining two not yet processed submissions, one has invalid |
|
302 |
data, the other submission is valid. |
|
303 |
||
7123.1.2
by Abel Deuring
implemented reviewer's comments |
304 |
>>> returnvalue, out, err = run_script( |
305 |
... 'cronscripts/process-hwdb-submissions.py') |
|
306 |
>>> returnvalue |
|
307 |
0 |
|
6978.2.11
by Abel Deuring
added a test for the cronscript |
308 |
>>> print err |
7675.624.72
by Tim Penhey
Gee there are a lot of these lockfile creation fixes. |
309 |
INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock |
6978.2.11
by Abel Deuring
added a test for the cronscript |
310 |
ERROR Parsing submission unique-id-1: syntax error: line 1, column 0 |
311 |
INFO Processed 1 valid and 1 invalid HWDB submissions |
|
312 |
>>> print out |
|
313 |
<BLANKLINE> |
|
314 |
||
315 |
Now we have one valid, two invalid and no unprocessed submissions. |
|
316 |
||
317 |
>>> # We must start a new transaction in order to see the effects |
|
318 |
>>> # the script had on the database. |
|
319 |
>>> transaction.commit() |
|
320 |
>>> new_submissions = submission_set.getByStatus( |
|
321 |
... HWSubmissionProcessingStatus.SUBMITTED) |
|
6978.2.12
by Abel Deuring
added a docstring for the cronscript |
322 |
>>> print new_submissions.count() |
6978.2.11
by Abel Deuring
added a test for the cronscript |
323 |
0 |
324 |
>>> processed_submissions = submission_set.getByStatus( |
|
325 |
... HWSubmissionProcessingStatus.PROCESSED) |
|
326 |
>>> for submission in processed_submissions: |
|
327 |
... print submission.submission_key, submission.status.title |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
328 |
sample-submission Processed |
6978.2.11
by Abel Deuring
added a test for the cronscript |
329 |
unique-id-68 Processed |
330 |
||
331 |
>>> invalid_submissions = submission_set.getByStatus( |
|
332 |
... HWSubmissionProcessingStatus.INVALID) |
|
333 |
>>> for submission in invalid_submissions: |
|
334 |
... print submission.submission_key, submission.status.title |
|
335 |
test_submission_id_1 Invalid submission |
|
336 |
unique-id-1 Invalid submission |
|
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
337 |
|
7123.1.2
by Abel Deuring
implemented reviewer's comments |
338 |
Larger numbers of submissions can be processed too. Add enough submissions |
339 |
that scripts.hwdbsubmissions.ProcessingLoop is called at least twice. |
|
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
340 |
|
341 |
>>> form['field.submission_data'] = valid_sample_data |
|
342 |
>>> for serial in range(80): |
|
343 |
... form['field.submission_key'] = u'submission-%i' % serial |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
344 |
... submit_view = create_initialized_view( |
345 |
... app, name='+submit', form=form) |
|
7123.1.2
by Abel Deuring
implemented reviewer's comments |
346 |
|
347 |
Now we have 80 new submissions and three submissions that were processed |
|
348 |
in previous tests. |
|
349 |
||
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
350 |
>>> print submission_set.getByStatus( |
351 |
... HWSubmissionProcessingStatus.SUBMITTED).count() |
|
352 |
80 |
|
353 |
>>> print submission_set.getByStatus( |
|
354 |
... HWSubmissionProcessingStatus.PROCESSED).count() |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
355 |
2 |
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
356 |
>>> print submission_set.getByStatus( |
357 |
... HWSubmissionProcessingStatus.INVALID).count() |
|
358 |
2 |
|
359 |
>>> transaction.commit() |
|
7123.1.2
by Abel Deuring
implemented reviewer's comments |
360 |
|
361 |
Let's leave some submissions unprocessed in order to check if the |
|
362 |
processing loop terminates properly, when the parameter "-m" is given. |
|
363 |
||
364 |
>>> returnvalue, out, err = run_script( |
|
365 |
... 'cronscripts/process-hwdb-submissions.py', ['-m60']) |
|
366 |
>>> returnvalue |
|
367 |
0 |
|
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
368 |
>>> print err |
7675.624.72
by Tim Penhey
Gee there are a lot of these lockfile creation fixes. |
369 |
INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock |
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
370 |
INFO Processed 60 valid and 0 invalid HWDB submissions |
371 |
>>> print out |
|
372 |
<BLANKLINE> |
|
373 |
>>> print submission_set.getByStatus( |
|
374 |
... HWSubmissionProcessingStatus.SUBMITTED).count() |
|
375 |
20 |
|
376 |
>>> print submission_set.getByStatus( |
|
377 |
... HWSubmissionProcessingStatus.PROCESSED).count() |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
378 |
62 |
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
379 |
>>> print submission_set.getByStatus( |
380 |
... HWSubmissionProcessingStatus.INVALID).count() |
|
381 |
2 |
|
382 |
||
7123.1.2
by Abel Deuring
implemented reviewer's comments |
383 |
Let's add more subscription so that we have more than max_chunk_size |
384 |
unprocessed submissions and process all of them. |
|
385 |
||
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
386 |
>>> for serial in range(80, 160): |
387 |
... form['field.submission_key'] = u'submission-%i' % serial |
|
7942.1.4
by Barry Warsaw
Repair tests. Missing fields do not mean no entry in the request form, it |
388 |
... submit_view = create_initialized_view( |
389 |
... app, name='+submit', form=form) |
|
390 |
||
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
391 |
>>> print submission_set.getByStatus( |
392 |
... HWSubmissionProcessingStatus.SUBMITTED).count() |
|
393 |
100 |
|
394 |
>>> print submission_set.getByStatus( |
|
395 |
... HWSubmissionProcessingStatus.PROCESSED).count() |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
396 |
62 |
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
397 |
>>> print submission_set.getByStatus( |
398 |
... HWSubmissionProcessingStatus.INVALID).count() |
|
399 |
2 |
|
400 |
>>> transaction.commit() |
|
7123.1.2
by Abel Deuring
implemented reviewer's comments |
401 |
>>> returnvalue, out, err = run_script( |
402 |
... 'cronscripts/process-hwdb-submissions.py') |
|
403 |
>>> returnvalue |
|
404 |
0 |
|
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
405 |
>>> print err |
7675.624.72
by Tim Penhey
Gee there are a lot of these lockfile creation fixes. |
406 |
INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock |
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
407 |
INFO Processed 100 valid and 0 invalid HWDB submissions |
408 |
>>> print out |
|
409 |
<BLANKLINE> |
|
410 |
>>> print submission_set.getByStatus( |
|
411 |
... HWSubmissionProcessingStatus.SUBMITTED).count() |
|
412 |
0 |
|
413 |
>>> print submission_set.getByStatus( |
|
414 |
... HWSubmissionProcessingStatus.PROCESSED).count() |
|
7310.2.1
by Abel Deuring
Added sample data for HWDB devices |
415 |
162 |
7123.1.1
by Abel Deuring
two embarassing bugs in the loop management of the HWDB processing script fixed |
416 |
>>> print submission_set.getByStatus( |
417 |
... HWSubmissionProcessingStatus.INVALID).count() |
|
418 |
2 |