-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Random test failures with PathPatternBulkUpdateTestCase #4862
Comments
PR up for review: backdrop/backdrop#3483 I believe that the main culprit was this: https://github.com/backdrop/backdrop/blob/1.x/core/modules/path/tests/path_pattern.test#L942 // Create three tags terms.
$this->terms = array();
for ($i = 1; $i <= 3; $i++) {
$term = entity_create('taxonomy_term', array(
'name' => $this->randomName(),
'vocabulary' => 'tags',
'langcode' => LANGUAGE_NONE,
));
taxonomy_term_save($term);
$this->terms[$term->tid] = $term;
// Test that terms have proper aliases.
$this->assertEntityAlias('term', $term, 'tags/' . strtolower($term->name));
}
// Create three bulk_test terms.
$this->terms = array();
for ($i = 1; $i <= 3; $i++) {
$term = entity_create('taxonomy_term', array(
'name' => $this->randomName(),
'vocabulary' => 'bulk_test',
'langcode' => LANGUAGE_NONE,
));
taxonomy_term_save($term);
$this->terms[$term->tid] = $term;
// Test that terms have proper aliases.
$this->assertEntityAlias('term', $term, 'bulk-test/' . strtolower($term->name));
} Notice how there is a second // Bulk create aliases.
$edit = array(
'update[node][base]' => TRUE,
'update[taxonomy_term][base]' => TRUE,
'update[user][base]' => TRUE,
'operations[operation]' => 'generate',
);
$this->backdropPost('admin/config/urls/path/bulk-update', $edit, t('Execute'));
$this->assertText('Generated 20 URL aliases.'); // 12 nodes + 6 terms + 2 users ...it won't actually be 6 term aliases as expected/intended - the total will be 17 instead of 20 new aliases generated. Then the test goes on to add a new node: // Add a new node.
$new_node = $this->backdropCreateNode(array('path' => array('alias' => '', 'auto' => FALSE)));
$this->nodes[$new_node->nid] = $new_node; ...and then bulk-updates all aliases: // Run the update again which should only run against the new node.
$this->backdropPost('admin/config/urls/path/bulk-update', $edit, t('Execute'));
$this->assertText('Generated 1 URL alias.'); // 1 node + 0 users It expects only a single alias to be generated (for the newly-created node), but the 3 terms from the |
...the PR to fix the random failures could be as simple as removing that extra
|
It seems, this issue has stalled. No update since January, and the PR isn't ready yet. It has failing tests. Also, there's both, label "milestone candidate" and a milestone set, which is contradictory. Removing milestone. |
@klonos besides your code oddness findings... do you have steps to reproduce the problem locally? |
I rebased @klonos's PR and pushed up a new one at backdrop/backdrop#3733 (I closed the previous PR). One of the changes was incorrect.
All node aliases actually should have been removed at this point, since only post aliases were regenerated. I removed the failing checks but left the code comments in place to help clarify the situation. To also increase the robustness of the tests slightly I added a few lines at the beginning of the test to delete all default nodes (the sample page and post) that come with the standard profile, so this test won't break in the future if we add more sample content. |
I still have a few random failures happening. I begin to wonder if there is something specific to Batch API that causes random test failures. This PathPatternBulkUpdateTestCase, the BatchProcessingTestCase, ConfigurationUITest, and InstallerBrowserAdministrationTestCase all use Batch API and all intermittently fail. I tried combing |
So cool, many thanks @quicksketch for digging into this! It seems, you found the right approach (which I don't understand yet). Time to pop the corks? 🍾 |
🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 🎉 🍾 YAY!!!
I had actually rebased a few hrs earlier: ...and as you can see, I had started to try a series of things. Here's what I had typed here before heading for a nap:
But @quicksketch beat me to it! ❤️ PS: Fun fact: there's this Greek saying: "κοιμάσαι κι η τύχη σου δουλεύει", which loosely translates to "your luck was plotting while you were sleeping", which is exactly how I feel about this now! 😄 |
Actually - IMO it's not odd that this test redundantly failed - the real oddness is that it passed so often. 😜 PS: "κοιμάσαι κι η τύχη σου δουλεύει" has a corresponding German saying: "Den Seinen gibt's der Herr im Schlaf". |
I reworked this PR to remove the temporary fix I found. The "real" fix for this issue is now included in #5205. The new PR at backdrop/backdrop#3733 is now just clean-up. |
Since backdrop/backdrop#3733 is now only clean-up (reformatting, preventing notices, scoping variables) and it's still passing all tests I went ahead and merged this so we can close out this issue. We haven't had the actual test fail since #5205 was fixed. |
This is part of the #1478 meta.
The 2 failures that we are usually getting are:
"Generated 20 URL aliases." found path_pattern.test:929
"Generated 1 URL alias." found path_pattern.test:943
I've had enough with this 😅 ...so I took a look at the code, and have noticed some inconsistencies in it. Perhaps addressing these inconsistencies will also fix these failures.
The text was updated successfully, but these errors were encountered: