Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3449631
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
automatic_updates-3449631
Commits
192e70df
Commit
192e70df
authored
2 years ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3315798
by phenaproxima, tedbow: Post-apply always fails during cron
parent
7aa0e075
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CronUpdater.php
+9
-0
9 additions, 0 deletions
src/CronUpdater.php
tests/src/Build/CoreUpdateTest.php
+21
-2
21 additions, 2 deletions
tests/src/Build/CoreUpdateTest.php
with
30 additions
and
2 deletions
src/CronUpdater.php
+
9
−
0
View file @
192e70df
...
...
@@ -280,6 +280,15 @@ class CronUpdater extends Updater {
* An empty 200 response if the post-apply tasks succeeded.
*/
public
function
handlePostApply
(
string
$stage_id
,
string
$installed_version
,
string
$target_version
):
Response
{
$owner
=
$this
->
tempStore
->
getMetadata
(
static
::
TEMPSTORE_LOCK_KEY
)
->
getOwnerId
();
// Reload the tempstore with the correct owner ID so we can claim the stage.
// We use \Drupal::service() here because, given what we inherit from the
// parent class, there's no clean way to inject the shared tempstore
// factory.
$this
->
tempStore
=
\Drupal
::
service
(
'tempstore.shared'
)
->
get
(
'package_manager_stage'
,
$owner
);
$this
->
claim
(
$stage_id
);
// Run post-apply tasks in their own try-catch block so that, if anything
...
...
This diff is collapsed.
Click to expand it.
tests/src/Build/CoreUpdateTest.php
+
21
−
2
View file @
192e70df
...
...
@@ -121,11 +121,30 @@ class CoreUpdateTest extends UpdateTestBase {
*/
public
function
testCron
(
string
$template
):
void
{
$this
->
createTestProject
(
$template
);
// Install dblog so we can check if any errors were logged during the update.
$this
->
installModules
([
'dblog'
]);
$this
->
visit
(
'/admin/reports/status'
);
$mink
=
$this
->
getMink
();
$mink
->
assertSession
()
->
pageTextContains
(
'Your site is ready for automatic updates.'
);
$mink
->
getSession
()
->
getPage
()
->
clickLink
(
'Run cron'
);
$page
=
$mink
->
getSession
()
->
getPage
();
$assert_session
=
$mink
->
assertSession
();
$assert_session
->
pageTextContains
(
'Your site is ready for automatic updates.'
);
$page
->
clickLink
(
'Run cron'
);
$assert_session
->
statusCodeEquals
(
200
);
// There should be log messages, but no errors or warnings should have been
// logged by Automatic Updates.
$this
->
visit
(
'/admin/reports/dblog'
);
$assert_session
->
pageTextNotContains
(
'No log messages available.'
);
$page
->
selectFieldOption
(
'Type'
,
'automatic_updates'
);
$page
->
selectFieldOption
(
'Severity'
,
'Emergency'
,
TRUE
);
$page
->
selectFieldOption
(
'Severity'
,
'Alert'
,
TRUE
);
$page
->
selectFieldOption
(
'Severity'
,
'Critical'
,
TRUE
);
$page
->
selectFieldOption
(
'Severity'
,
'Warning'
,
TRUE
);
$page
->
pressButton
(
'Filter'
);
$assert_session
->
pageTextContains
(
'No log messages available.'
);
$this
->
assertUpdateSuccessful
(
'9.8.1'
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment