aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/jobqueue/JobTest.php
diff options
context:
space:
mode:
authorErik Bernhardson <ebernhardson@wikimedia.org>2016-04-11 14:00:43 -0700
committerErik Bernhardson <ebernhardson@wikimedia.org>2016-04-13 10:41:13 -0700
commitafc3b5a120a43a70c447ea15bfe85ba153a7ef10 (patch)
tree9e3838d7835b1a6e2036c2d0f67ff4c52df85d94 /tests/phpunit/includes/jobqueue/JobTest.php
parent3b480dd42bd3b4de57a4641ccd7d7f3f3f0ff4c3 (diff)
downloadmediawikicore-afc3b5a120a43a70c447ea15bfe85ba153a7ef10.tar.gz
mediawikicore-afc3b5a120a43a70c447ea15bfe85ba153a7ef10.zip
Track which web request created a job
We currently push a request id into structured logging (monolog/ logstash) to allow seeing all logs that were triggered by the same request. This extends that to pass the id through jobs so jobs triggered by a web request also share the same id and can be tracked together. This web request id will follow jobs both directly created by a request, and jobs created by those jobs. This should give us some more visibility when debugging into what started a particular job, and if a large number of jobs blowing up the job queue are somehow related. Change-Id: Iedbd031e6e9bb18fd6f7b923c8c305102255ab4b
Diffstat (limited to 'tests/phpunit/includes/jobqueue/JobTest.php')
-rw-r--r--tests/phpunit/includes/jobqueue/JobTest.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/phpunit/includes/jobqueue/JobTest.php b/tests/phpunit/includes/jobqueue/JobTest.php
index 3c648f9bceba..600a36ffe48e 100644
--- a/tests/phpunit/includes/jobqueue/JobTest.php
+++ b/tests/phpunit/includes/jobqueue/JobTest.php
@@ -23,34 +23,36 @@ class JobTest extends MediaWikiTestCase {
->method( '__toString' )
->will( $this->returnValue( '{STRING_OBJ_VAL}' ) );
+ $requestId = 'requestId=' . WebRequest::getRequestId();
+
return [
[
$this->getMockJob( false ),
- 'someCommand '
+ 'someCommand ' . $requestId
],
[
$this->getMockJob( [ 'key' => 'val' ] ),
- 'someCommand key=val'
+ 'someCommand key=val ' . $requestId
],
[
$this->getMockJob( [ 'key' => [ 'inkey' => 'inval' ] ] ),
- 'someCommand key={"inkey":"inval"}'
+ 'someCommand key={"inkey":"inval"} ' . $requestId
],
[
$this->getMockJob( [ 'val1' ] ),
- 'someCommand 0=val1'
+ 'someCommand 0=val1 ' . $requestId
],
[
$this->getMockJob( [ 'val1', 'val2' ] ),
- 'someCommand 0=val1 1=val2'
+ 'someCommand 0=val1 1=val2 ' . $requestId
],
[
$this->getMockJob( [ new stdClass() ] ),
- 'someCommand 0=object(stdClass)'
+ 'someCommand 0=object(stdClass) ' . $requestId
],
[
$this->getMockJob( [ $mockToStringObj ] ),
- 'someCommand 0={STRING_OBJ_VAL}'
+ 'someCommand 0={STRING_OBJ_VAL} ' . $requestId
],
[
$this->getMockJob( [
@@ -73,7 +75,8 @@ class JobTest extends MediaWikiTestCase {
'rootJobSignature=45868e99bba89064e4483743ebb9b682ef95c1a7 ' .
'rootJobTimestamp=20160309110158 masterPos=' .
'{"file":"db1023-bin.001288","pos":"308257743","asOfTime":1457521464.3814} ' .
- 'triggeredRecursive=1'
+ 'triggeredRecursive=1 ' .
+ $requestId
],
];
}