diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-02-05 01:22:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 01:22:11 +0300 |
commit | 490dc3a1a09e4263b4893cbbbf600ba505d9add4 (patch) | |
tree | 2fca42614fec12907ecac1ae217e1305baa4144a /plugins/CoreConsole | |
parent | bc53bc36ebebfe50d83d6ce381aa8bb6cd2cb15c (diff) |
Refactor segment re-archiving in past behavior to be on demand (#17005)
* Invalidate past archives on demand when adding/updating segments, rather than trying to check when running core:archive
* start on rewriting test
* rewrite SegmentArchivingTest and get to pass
* get sites as superuser
* add update to rearchive segments if they were created/update between last archive time and update time
* remove unused parameter
* fix build
* fix tests
* sanity check
* fix bug, we should not forget archives to invalidate unless all related archives are being invalidated
* fix tests and make fix more complete
* fix test
* update counts in test
* fix test for last time hopefully
* fix another test
* remove debugging code
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r-- | plugins/CoreConsole/tests/System/ArchiveCronTest.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php index 7886614f95..3b01828a12 100644 --- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php +++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\CoreConsole\tests\System; use Piwik\CronArchive; use Piwik\Plugins\SegmentEditor\API; +use Piwik\Site; use Piwik\Tests\Framework\TestingEnvironmentVariables; use Psr\Container\ContainerInterface; use Piwik\Archive\ArchiveInvalidator; @@ -53,6 +54,7 @@ class ArchiveCronTest extends SystemTestCase parent::setUpBeforeClass(); Db::exec("UPDATE " . Common::prefixTable('site') . ' SET ts_created = \'2005-01-02 00:00:00\''); + Site::clearCache(); } private static function addNewSegmentToPast() @@ -176,6 +178,9 @@ class ArchiveCronTest extends SystemTestCase $tracker->setUrl('http://example.com/test/url'); Fixture::checkResponse($tracker->doTrackPageView('abcdefg')); + $invalidationEntries = $this->getInvalidatedArchiveTableEntries(); + $this->assertGreaterThan(0, count($invalidationEntries)); + // empty the list so nothing is invalidated during core:archive (so we only archive ExamplePlugin and not all plugins) $invalidator->forgetRememberedArchivedReportsToInvalidate(1, Date::factory('2007-04-05')); |