~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/doc/buildd-slavescanner.txt

Mass renaming of imports and references to IBuild/Build/IBuildSet

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
following states: FAILEDTOBUILD and CHROOTWAIT
69
69
 
70
70
    >>> from lp.buildmaster.interfaces.builder import IBuilderSet
71
 
    >>> from lp.soyuz.interfaces.build import IBuildSet
 
71
    >>> from lp.soyuz.interfaces.binarypackagebuild import (
 
72
    ...     IBinaryPackageBuildSet)
72
73
    >>> import datetime, pytz
73
74
 
74
75
    >>> UTC = pytz.timezone('UTC')
75
76
 
76
77
We want to get a Build and make BuildQueue items for it:
77
78
 
78
 
    >>> a_build = getUtility(IBuildSet).getByBuildID(8)
 
79
    >>> a_build = getUtility(IBinaryPackageBuildSet).getByBuildID(8)
79
80
 
80
81
To make testing easier we provide a convenience function to put a BuildQueue
81
82
object into a preset fixed state:
128
129
 
129
130
Do the test execution:
130
131
 
131
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem3)
 
132
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem3)
132
133
    >>> a_builder.updateBuild(bqItem3)
133
134
    >>> build.builder is not None
134
135
    True
158
159
 
159
160
Do the test execution:
160
161
 
161
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem4)
 
162
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem4)
162
163
    >>> a_builder.updateBuild(bqItem4)
163
164
    CRITICAL:slave-scanner:***** bob is MANUALDEPWAIT *****
164
165
    >>> build.builder is not None
187
188
 
188
189
    >>> bqItem5.builder.setSlaveForTesting(
189
190
    ...     WaitingSlave('BuildStatus.CHROOTFAIL'))
190
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem5)
 
191
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem5)
191
192
    >>> a_builder.updateBuild(bqItem5)
192
193
    CRITICAL:slave-scanner:***** bob is CHROOTWAIT *****
193
194
    >>> build.builder is not None
226
227
    True
227
228
    >>> check_mail_sent(last_stub_mail_count)
228
229
    False
229
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem6)
 
230
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem6)
230
231
    >>> print build.buildstate.title
231
232
    Pending build
232
233
    >>> job = bqItem6.specific_job.job
335
336
(precisely on binary upload time), the build will be considered
336
337
FAILEDTOUPLOAD:
337
338
 
338
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem10)
 
339
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem10)
339
340
    >>> a_builder.updateBuild(bqItem10)
340
341
    WARNING:slave-scanner:Build ... upload failed.
341
342
    >>> build.builder is not None
401
402
this case cleanly. We need to set the pocket to updates for this test as its
402
403
uploading to warty.
403
404
 
404
 
    >>> bqItem10 = getUtility(IBuildSet).getByBuildID(
 
405
    >>> bqItem10 = getUtility(IBinaryPackageBuildSet).getByBuildID(
405
406
    ...     6).queueBuild()
406
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem10)
 
407
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem10)
407
408
 
408
409
XXX: The pocket attribute is not intended to be changed in regular code, but
409
410
for this test we want to change it on the fly. An alternative would be to add
476
477
    0
477
478
    >>> check_mail_sent(last_stub_mail_count)
478
479
    False
479
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem11)
 
480
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem11)
480
481
    >>> print build.buildstate.title
481
482
    Pending build
482
483
    >>> job = bqItem11.specific_job.job
492
493
investigate why this build end up built. (should never happen in real
493
494
cases, and even so should be refused when we try to upload it.)
494
495
 
495
 
    >>> bqItem12 = getUtility(IBuildSet).getByBuildID(
 
496
    >>> bqItem12 = getUtility(IBinaryPackageBuildSet).getByBuildID(
496
497
    ...     2).queueBuild()
497
498
    >>> setupBuildQueue(bqItem12, a_builder)
498
499
    >>> last_stub_mail_count = len(stub.test_emails)
513
514
The buildlog is collected and compressed locally using gzip algorithm,
514
515
let's see how this method works:
515
516
 
516
 
    >>> bqItem10 = getUtility(IBuildSet).getByBuildID(
 
517
    >>> bqItem10 = getUtility(IBinaryPackageBuildSet).getByBuildID(
517
518
    ...     6).queueBuild()
518
519
    >>> setupBuildQueue(bqItem10, a_builder)
519
520
    >>> bqItem10.builder.setSlaveForTesting(WaitingSlave('BuildStatus.OK'))
690
691
tests.
691
692
 
692
693
    >>> current_job = a_builder.currentjob
693
 
    >>> resurrect_build = getUtility(IBuildSet).getByQueueEntry(current_job)
 
694
    >>> resurrect_build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(
 
695
    ...     current_job)
694
696
    >>> resurrect_build.buildstate = BuildStatus.NEEDSBUILD
695
697
    >>> syncUpdate(resurrect_build)
696
698
    >>> current_job.builder = None
702
704
corresponding build record as SUPERSEDED.
703
705
 
704
706
    >>> old_candidate = removeSecurityProxy(a_builder)._findBuildCandidate()
705
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(old_candidate)
 
707
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(
 
708
    ...     old_candidate)
706
709
    >>> print build.buildstate.name
707
710
    NEEDSBUILD
708
711
 
766
769
aside to convert these to unit-tests.
767
770
 
768
771
    >>> naked_build = removeSecurityProxy(
769
 
    ...     getUtility(IBuildSet).getByQueueEntry(new_candidate))
 
772
    ...     getUtility(IBinaryPackageBuildSet).getByQueueEntry(new_candidate))
770
773
    >>> original_archive = naked_build.archive
771
774
    >>> secure_pub = naked_build.current_source_publication
772
775
    >>> commit()
813
816
    >>> commit()
814
817
    >>> LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser)
815
818
 
816
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(current_job)
 
819
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(
 
820
    ...     current_job)
817
821
    >>> print build.buildstate.name
818
822
    NEEDSBUILD
819
823
 
1047
1051
    >>> commit()
1048
1052
    >>> LaunchpadZopelessLayer.switchDbUser('launchpad')
1049
1053
    >>> login('foo.bar@canonical.com')
1050
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(candidate)
 
1054
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(
 
1055
    ...     candidate)
1051
1056
    >>> for build_file in build.sourcepackagerelease.files:
1052
1057
    ...     removeSecurityProxy(build_file).libraryfile.restricted = True
1053
1058
    >>> private_ppa = factory.makeArchive(
1081
1086
archive and not the one from the PPA, which on the absence of ancestry
1082
1087
defaults to 'universe'.
1083
1088
 
1084
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(candidate)
 
1089
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(candidate)
1085
1090
    >>> print build.current_component.name
1086
1091
    main
1087
1092
 
1306
1311
    >>> a_builder.currentjob.destroySelf()
1307
1312
 
1308
1313
    >>> bqItem3 = a_build.queueBuild()
1309
 
    >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem3)
 
1314
    >>> build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(bqItem3)
1310
1315
    >>> removeSecurityProxy(build).pocket = (
1311
1316
    ...     PackagePublishingPocket.UPDATES)
1312
1317
    >>> last_stub_mail_count = len(stub.test_emails)