summaryrefslogtreecommitdiff
path: root/cbuildbot/stages/report_stages_unittest.py
AgeCommit message (Collapse)Author
2015-04-09stages: rename test cases with "TestCase" suffixMike Frysinger
For test classes which are meant to be the basis of other tests, we use the common convention of calling them "XxxTestCase". Update some that weren't following that. BUG=None TEST=`./cbuildbot/run_tests` passes Change-Id: I75f6085952a2876cafdb158b26e81cb2b166bb79 Reviewed-on: https://chromium-review.googlesource.com/264566 Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org> Trybot-Ready: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2015-02-19cidb: refactor CIDBConnectionFactory to use factory.pyAviv Keshet
BUG=chromium:458284 TEST=Unit tests Change-Id: Iead1819fc0299daf20400db6d521d8922f7f0e4f Reviewed-on: https://chromium-review.googlesource.com/250621 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org> Commit-Queue: Aviv Keshet <akeshet@chromium.org>
2015-01-22Enable infra alerts for Golo but not GCE trybots.David James
This CL enables infra alerts in the Golo trybot waterfall for the first time. Infra alerts were previously disabled because of a typo where we were looking at options.debug, which was always True for trybots. We actually want self.debug, so we switched to that instead. GCE trybots are blocked from sending email over standard ports at the firewall level. It is possible to send email from GCE using the instructions at https://cloud.google.com/compute/docs/sending-mail , but that'll require some work. For now, only enable infra alerts in the Golo. BUG=chromium:449624 TEST=Run sample trybot run with infra error and make sure alert is sent. Change-Id: I7f7ae3dd32b3a77cdc1ce0dee7eaeb3ba501bbb8 Reviewed-on: https://chromium-review.googlesource.com/242299 Reviewed-by: David James <davidjames@chromium.org> Commit-Queue: David James <davidjames@chromium.org> Trybot-Ready: David James <davidjames@chromium.org> Tested-by: David James <davidjames@chromium.org>
2015-01-21unittests: cut over to the new wrapperMike Frysinger
Now that we have a wrapper to deal with the namespace munging, we can clean up all our unittests. This means: - add a wrapper symlink for all the unittests - drop the +x bits on the direct .py file - drop the shebang on the direct .py file - delete the manual sys.path munging - move the mock import to the common system import path - delete unused os/sys imports - delete most manual calls to cros_test_lib.main - add a main() for the few complicated cros_test_lib.main calls BUG=chromium:219660 TEST=ran all the unittests Change-Id: I85614c301e48c86a0ca4201c2b60349d2d488e52 Reviewed-on: https://chromium-review.googlesource.com/233832 Reviewed-by: David James <davidjames@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
2015-01-08report_stages: enforce that master and slave are the same versionAviv Keshet
This CL will cause slaves that have somehow picked up a ChromeOS version that doesn't match their master's version to fail in BuildReexecutionFinished. This sanity check prevents the CQ accidentally commiting untested changes. BUG=chromium:427648 TEST=New unit tests added for preexisting and new behavior. Verified that unit test fails prior to fix. Change-Id: Ib83620b18857d3b6726778cdb67c792b02e26425 Reviewed-on: https://chromium-review.googlesource.com/239350 Tested-by: Aviv Keshet <akeshet@chromium.org> Reviewed-by: David James <davidjames@chromium.org> Commit-Queue: Aviv Keshet <akeshet@chromium.org>
2014-12-20cbuildbot: Use build 'deadline' to abort slaves when master quits.Prathmesh Prabhu
When builds are launched in the master-slave model, we'd like to abort the slaves about the same time when the master times out on them. After this CL, - The master posts a reasonable deadline for the build to cidb, and waits for slaves to finish till that deadline. - The slaves abort themselves if the deadline set by their master is hit. - CQ Master: waits for a long time in the sync stage for CLs to be +2'ed, so it extends the deadline after the sync stage so that slaves have enough time to finish their build. BUG=chromium:431836 TEST=(1) ./cbuildbot/run_tests (2) Launch a master trybot and verify that a sensible deadline is posted to cidb. (3) Launch a slave trybot pointing to the earlier master trybot as the master, and verify that the slave posts the same deadline and aborts when the deadline is hit. Change-Id: Idebd09630eda1be10afae462d38f41ff913004de Reviewed-on: https://chromium-review.googlesource.com/234853 Tested-by: Prathmesh Prabhu <pprabhu@chromium.org> Reviewed-by: David James <davidjames@chromium.org> Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
2014-12-09lint: cbuildbot: clean up a bitMike Frysinger
Mostly a focus on bad whitespace, but also drop some obsolete warnings. BUG=chromium:431514 TEST=no more lint errors TEST=`./cbuildbot/run_tests` passes Change-Id: Ie94bd5d6b2abf3a37cfc51e0af1d1abe815fcdac Reviewed-on: https://chromium-review.googlesource.com/233840 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2014-11-21lint: update support for pylint-1.xMike Frysinger
This doesn't fix the new warnings, but makes `cros lint` work. BUG=chromium:431514 TEST=`cros lint <files>` no longer crashes TEST=`cros/commands/lint_unittest.py` passes Change-Id: I908abd03027cfc348ed3e74454d9cc0e556ca29d Reviewed-on: https://chromium-review.googlesource.com/228721 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2014-11-15Make ReportStage stable if SyncStage didn't complete.Don Garrett
If the SyncStage didn't complete, we wouldn't have a release tag. That would kill the ReportStage. After this CL, we skip the archival work but still generate our report data, and finalize CIDB. BUG=chromium:432752 TEST=Unittests + tryjobs. Change-Id: I7a7f0e4ff2008749f26a07504795c8e869cacf44 Reviewed-on: https://chromium-review.googlesource.com/229460 Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Don Garrett <dgarrett@chromium.org> Tested-by: Don Garrett <dgarrett@chromium.org>
2014-11-12Migrate unit tests that mock cidb from mox to mockYu-Ju Hong
BUG=chromium:430770 TEST=`cbuildbot/run_tests Change-Id: Ia9bec172b5d73ae52480fd4cabed8f8aeb780bad Reviewed-on: https://chromium-review.googlesource.com/229181 Tested-by: Yu-Ju Hong <yjhong@chromium.org> Reviewed-by: Aviv Keshet <akeshet@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
2014-10-22report_stage: update the LATEST markers only when the build passedYu-Ju Hong
The version stored in the LATEST markers represents the last known good build, so the files should be updated only when the build passed. BUG=chromium:407322 TEST=`cbuildbot/run_tests` Change-Id: Id0ab248fe96af4f28437a131e3c8167ff51ea1fb Reviewed-on: https://chromium-review.googlesource.com/224802 Tested-by: Yu-Ju Hong <yjhong@chromium.org> Reviewed-by: David James <davidjames@chromium.org> Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
2014-10-16cidb: eliminate CL status filesAviv Keshet
This CL eliminates use of CL status files and status counters. For the CQ, the status counters were used in generating summary text that included the number of prior failures (and in the past also in identifying suspects, but this is no longer the case). The counters have been replaced by counting the number of occurences of KICKED_OUT actions for the change. For the pre-CQ, status files were used to coordinate and track state, by the pre-cq-launcher, the pre-cq-group, and master-paladin. These are replaced by status transition actions that are recorded to cidb. The pre-cq status of a given change is the status corresponding to the most recent pre-cq status action. - Rename PRE_CQ_BUILDER_NAME for consistency. - Rename GetCLStatus to GetCLPreCQStatus, update all its callers, and rewrite it to use the last known pre-CQ action for a change as its pre-cq status. - Rename UpdateCLStatus to UpdateCLPreCQStatus, update all its callers (deleting callers that were CQ-specific), and rewrite it to only record a status transition action to cidb. - Delete _FindPreviouslyFailedChanges, which was not used anywhere. - Do not update a change's pass_count, this was only used when printing CL summary links, and not clear why this should ever be nonzero. - Delete CLStatusMock, instead use FakeCIDBConnection in unit tests and do not mock out the CL status methods. BUG=chromium:410546 TEST=`git grep PRE_CQ_BUILDER_NAME` -> no results `git grep GetCLStatus` -> no results `git grep UpdateCLStatus` -> no results `git grep _FindPreviouslyFailedChanges` -> no results New unit tests of GetCLActionCount, UpdateCLPreCQStatus, and GetCLPreCQStatus. Existing unit tests fixed and passing. Remote trybots. Local trybots. Change-Id: I91752207782ff7278e0a4ada4388fcf3509b1860 Reviewed-on: https://chromium-review.googlesource.com/221956 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-10-15Add per-board status to metadata.json filesChristine Lee
Add per-board status to child-config list in metadata.json files. This does not contain any CIDB changes. BUG=chromium:380738 TEST=Unit tests Change-Id: Ie20611af675abc16f4e930fae741b2985d4ec6f5 Reviewed-on: https://chromium-review.googlesource.com/220899 Reviewed-by: Christine Lee <leecy@chromium.org> Commit-Queue: Christine Lee <leecy@chromium.org> Tested-by: Christine Lee <leecy@chromium.org>
2014-10-09retry_stats: Add a new mechanism for measuring retry performance.Don Garrett
This adds a new class which can be used to measure the performance of anything wrapped with a retry loop. The most common case is for external services like Google Storage. BUG=chromium:420272 TEST=New Unittests + trybot run to view result stats. Change-Id: I827282ce4ea2f33a19572430f38f81c18836c210 Reviewed-on: https://chromium-review.googlesource.com/221479 Reviewed-by: Don Garrett <dgarrett@chromium.org> Tested-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Don Garrett <dgarrett@chromium.org>
2014-10-03Revert "cidb: eliminate CL status files"Aviv Keshet
This reverts commit d31fd83ef85741efef943c76bb07ab304fdeca50. Change-Id: I1b690758e9d4aeef36ebd78c335f31d356fc55bb Reviewed-on: https://chromium-review.googlesource.com/221181 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-10-03cidb: eliminate CL status filesAviv Keshet
This CL eliminates use of CL status files and status counters. For the CQ, the status counters were used in generating summary text that included the number of prior failures (and in the past also in identifying suspects, but this is no longer the case). The counters have been replaced by counting the number of occurences of KICKED_OUT actions for the change. For the pre-CQ, status files were used to coordinate and track state, by the pre-cq-launcher, the pre-cq-group, and master-paladin. These are replaced by status transition actions that are recorded to cidb. The pre-cq status of a given change is the status corresponding to the most recent pre-cq status action. - Rename PRE_CQ_BUILDER_NAME for consistency. - Rename GetCLStatus to GetCLPreCQStatus, update all its callers, and rewrite it to use the last known pre-CQ action for a change as its pre-cq status. - Rename UpdateCLStatus to UpdateCLPreCQStatus, update all its callers (deleting callers that were CQ-specific), and rewrite it to only record a status transition action to cidb. - Delete _FindPreviouslyFailedChanges, which was not used anywhere. - Do not update a change's pass_count, this was only used when printing CL summary links, and not clear why this should ever be nonzero. - Delete CLStatusMock, instead use FakeCIDBConnection in unit tests and do not mock out the CL status methods. BUG=chromium:410546 TEST=`git grep PRE_CQ_BUILDER_NAME` -> no results `git grep GetCLStatus` -> no results `git grep UpdateCLStatus` -> no results `git grep _FindPreviouslyFailedChanges` -> no results New unit tests of GetCLActionCount, UpdateCLPreCQStatus, and GetCLPreCQStatus. Existing unit tests fixed and passing. Remote trybots. Local trybots. Change-Id: Ida3dffddad24ffc658bae0700ff7a394c356f838 Reviewed-on: https://chromium-review.googlesource.com/221359 Tested-by: Aviv Keshet <akeshet@chromium.org> Reviewed-by: David James <davidjames@chromium.org>
2014-10-03Revert "cidb: eliminate CL status files"Aviv Keshet
This reverts commit 91f687c1b6254335bbe8fa37fa39e43994fe496f. Change-Id: I26c0c9bf70b7f21e27fb4d03776fb5a855a05b58 Reviewed-on: https://chromium-review.googlesource.com/221382 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-10-03cidb: eliminate CL status filesAviv Keshet
This CL eliminates use of CL status files and status counters. For the CQ, the status counters were used in generating summary text that included the number of prior failures (and in the past also in identifying suspects, but this is no longer the case). The counters have been replaced by counting the number of occurences of KICKED_OUT actions for the change. For the pre-CQ, status files were used to coordinate and track state, by the pre-cq-launcher, the pre-cq-group, and master-paladin. These are replaced by status transition actions that are recorded to cidb. The pre-cq status of a given change is the status corresponding to the most recent pre-cq status action. - Rename PRE_CQ_BUILDER_NAME for consistency. - Rename GetCLStatus to GetCLPreCQStatus, update all its callers, and rewrite it to use the last known pre-CQ action for a change as its pre-cq status. - Rename UpdateCLStatus to UpdateCLPreCQStatus, update all its callers (deleting callers that were CQ-specific), and rewrite it to only record a status transition action to cidb. - Delete _FindPreviouslyFailedChanges, which was not used anywhere. - Do not update a change's pass_count, this was only used when printing CL summary links, and not clear why this should ever be nonzero. - Delete CLStatusMock, instead use FakeCIDBConnection in unit tests and do not mock out the CL status methods. BUG=chromium:410546 TEST=`git grep PRE_CQ_BUILDER_NAME` -> no results `git grep GetCLStatus` -> no results `git grep UpdateCLStatus` -> no results `git grep _FindPreviouslyFailedChanges` -> no results New unit tests of GetCLActionCount, UpdateCLPreCQStatus, and GetCLPreCQStatus. Existing unit tests fixed and passing. Remote trybots. Local trybots. Change-Id: I50966ec233f2caea620a25f36d0b12e28eb34565 Reviewed-on: https://chromium-review.googlesource.com/220599 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-09-18convert to print_functionMike Frysinger
BUG=chromium:414895 TEST=`./cbuildbot/run_tests` passes TEST=`cros lint` passes (it complains if print is used incorrectly) TEST=`cbuildbot chromiumos-sdk` passes TEST=`cbuildbot lumpy-release` passes Change-Id: I67e7e1290b03a16525e0c2b1afa74ebbd8d3508f Reviewed-on: https://chromium-review.googlesource.com/218572 Reviewed-by: David James <davidjames@chromium.org> Reviewed-by: Yu-Ju Hong <yjhong@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2014-09-04cidb: use database timestamp everywhereAviv Keshet
This CL causes start_time, finish_time, and CL action timestamp values to always use the current database time. This makes all time values stored in the database directly comparable. This CL also eliminates unneccesary code in cidb_integration_test now that the live databases have been migrated to schema version 11. BUG=None TEST=cidb_integration test; unit tests; remote trybot Change-Id: Ie066520dded26a0c6939b68112f7e41f4019115d Reviewed-on: https://chromium-review.googlesource.com/215993 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Commit-Queue: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-08-28cidb: ensure that we do not switch db instances mid-buildAviv Keshet
Once a buildTable entry is inserted, it is imperative that we do not associate that build_id with any other database instance. Add a check to BuildStart's HandleSkip (which will run on re-executions) to ensure that this is the case. If a database instance change is detected, invalidate the cidb connection factory and throw an assertion error. BUG=None TEST=Unit tests pass, including new unit test. Change-Id: I83c03b30764c4c05b375d175419056f5486690b5 Reviewed-on: https://chromium-review.googlesource.com/214059 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Commit-Queue: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-08-23cidb: use the cidb on our buildersAviv Keshet
This CL enables use of the cidb on builders run with --buildbot. In particular: - The cidb connection factory uses a cached cidb connection to avoid creating duplicate connections per cbuildbot execution. - A new stage, BuildStart is added, which is the first stage to run and which inserts a build row into the database if appropriate. - ReportBuildStart is renamed to BuildReexecutionFinished for clarity. - UploadMetadata is extended to also update the build row in the database. - Calls to RecordCLAction are accompanied by a CL action database insert. - ReportStage calls FinishBuild and writes the final build status to the database. BUG=chromium:387755 TEST=cidb_integration_test; remote trybots with --buildbot --debug, verified by inspecting database that expected data is written there. Change-Id: Ia2d9d355a744cafda0ade851be141519c56093d8 Reviewed-on: https://chromium-review.googlesource.com/211648 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Commit-Queue: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-08-22Send CQ alert emails to the tree sheriffsYu-Ju Hong
This CL enables sending alert emails to the tree sheriffs. As part of the process, functions that retrieve sheriff's email address are moved to tree_status.py. BUG=None TEST=`cbuildbot/run_tests` Change-Id: Ib166d7d6e6e40bb9c7df1955d4e3c0a7d1f6a470 Reviewed-on: https://chromium-review.googlesource.com/212883 Tested-by: Yu-Ju Hong <yjhong@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
2014-07-21chromite: Report perf values from image test stageNam T. Nguyen
Image tests can call OutputPerfValues during their runs. The stage will then aggregate all recorded perf values and report them to chromeperf. lib/perf_dashboard_config.json is a list of dictionaries of known performance tests: [ { 'master_name': 'ChromeOSPerf', # Master in ChromePerf 'test_name': 'image_test.ClassName.TestMethodName' # The test }, ... ] This CL also removes BuilderRunMock from general_stages_unittest and give ImageTestStage option and config name 'image_test'. BUG=chromium:386198 BUG=chromium:394076 TEST=unittest TEST=trybot on "release" group Change-Id: I65895f95d0c9b0402db36a8e72c1dfc6878547b5 Reviewed-on: https://chromium-review.googlesource.com/207818 Reviewed-by: Nam Nguyen <namnguyen@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
2014-07-08write some basic metadata values as early as possibleAviv Keshet
There are a few metadata values that, if they are missing from metadata.json, make the metadata file break gather_builder_stats. Now that the metadata object is preserved across cbuildbot re-executions, write some important values to metadata as soon as possible (at the very beginning of the run) rather than waiting until after a SyncStage has run. BUG=chromium:369748 TEST=local tryjobs; new unit test Change-Id: I91b7386772ee0db2256ff97223dd79bb00c947fd Reviewed-on: https://chromium-review.googlesource.com/206589 Reviewed-by: Aviv Keshet <akeshet@chromium.org> Commit-Queue: Aviv Keshet <akeshet@chromium.org> Tested-by: Aviv Keshet <akeshet@chromium.org>
2014-06-05Start renaming cbuildbot.(cbuildbot_)* to cbuildbot.*.David James
- Rename cbuildbot.cbuildbot_commands -> cbuildbot.commands. - Rename cbuildbot.cbuildbot_failures -> cbuildbot.failures_lib. - Rename cbuildbot.cbuildbot_results -> cbuildbot.results_lib. I have intentionally not touched the order of import statements yet to put them back in order, since this change can be landed separately. BUG=none CQ-DEPEND=CL:*165269 TEST=All unit tests. TEST=Full release trybot run. TEST=Paladin trybot run. Change-Id: Ib40a0f03ddc97da300a7889f324c59bbe8212dc3 Reviewed-on: https://chromium-review.googlesource.com/202650 Commit-Queue: David James <davidjames@chromium.org> Reviewed-by: David James <davidjames@chromium.org> Tested-by: David James <davidjames@chromium.org>
2014-05-29Copy LATEST markers to extra upload archives.Simran Basi
Currently we don't upload the LATEST markers. This change looks up the board for each builder_run in the report stage and also uploads the LATEST marker to the extra archives if there are any. BUG=chromium:375354 TEST=Rambi-paladin trybot run. sandybridge-ivybridge-release-group trybot run. report_stages_unittest. Change-Id: I2863561b8e312aa5499fce9501c5215db0732f0b Reviewed-on: https://chromium-review.googlesource.com/201233 Tested-by: Simran Basi <sbasi@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Simran Basi <sbasi@chromium.org>
2014-05-26Rename chromite.buildbot -> chromite.cbuildbot.Don Garrett
The cbuildbot script lives in a directory named buildbot. Which is a bit confusing. BUG=chromium:373277 TEST=Unitests + cros lint. CQ-DEPEND=CL:200157 CQ-DEPEND=CL:200165 CQ-DEPEND=CL:200149 CQ-DEPEND=CL:*163598 CQ-DEPEND=CL:*163760 CQ-DEPEND=CL:*163786 Change-Id: Ia5953a4506e8b47d27e1a6908ecb938a439da8c2 Reviewed-on: https://chromium-review.googlesource.com/199664 Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Don Garrett <dgarrett@chromium.org> Tested-by: Don Garrett <dgarrett@chromium.org>