1
0
mirror of https://github.com/owncloud/ocis.git synced 2026-10-23 23:29:02 +03:00
Files
ocis/tests/acceptance/bootstrap/bootstrap.php
Pradip Subedi a66ae6783d [tests-only][full-ci] test: fix flaky grouped email notification (#12882)
* test:start auth-bearer service separately instead of via OCIS_ADD_RUN_SERVICES

* test: fix timezone-dependent expiry assertions and flaky email notification

* test: simplify host timezone detection and log the UTC fallback

* test: oonly run cli commands test suite

* test: run all suites

* test: resolve the expiry timestamp in the timezone the mail was sent in

* test: inline the UTC expiration date conversion and drop the helper

* test: simplify the mail timezone formatter and restore the CI coverage guard
2026-10-01 16:37:56 +05:45

120 lines
4.3 KiB
PHP

<?php declare(strict_types=1);
/**
* ownCloud
*
* @author Phil Davis <phil@jankaritech.com>
* @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License,
* as published by the Free Software Foundation;
* either version 3 of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
use Composer\Autoload\ClassLoader;
// Acceptance tests use UTC for consistent date/time handling.
date_default_timezone_set('UTC');
$classLoader = new ClassLoader();
$classLoader->addPsr4("TestHelpers\\", __DIR__ . "/../TestHelpers", true);
$classLoader->register();
// while running for the local API tests, the tests code from ownCloud/core is not used
// so we need the constants to be defined for the tests to use them, but for the case where,
// the tests are running for oC/core API tests, the constants are already defined in the bootstrap.php there
// so we do not declare them again to avoid the "already defined" error
// Sleep for 10 milliseconds
if (!\defined('STANDARD_SLEEP_TIME_MILLISEC')) {
\define('STANDARD_SLEEP_TIME_MILLISEC', 10);
}
if (!\defined('STANDARD_SLEEP_TIME_MICROSEC')) {
\define('STANDARD_SLEEP_TIME_MICROSEC', STANDARD_SLEEP_TIME_MILLISEC * 1000);
}
// Long timeout for use in code that needs to wait for known slow UI
if (!\defined('LONG_UI_WAIT_TIMEOUT_MILLISEC')) {
\define('LONG_UI_WAIT_TIMEOUT_MILLISEC', 60000);
}
// Default timeout for use in code that needs to wait for the UI
if (!\defined('STANDARD_UI_WAIT_TIMEOUT_MILLISEC')) {
\define('STANDARD_UI_WAIT_TIMEOUT_MILLISEC', 10000);
}
// Minimum timeout for use in code that needs to wait for the UI
if (!\defined('MINIMUM_UI_WAIT_TIMEOUT_MILLISEC')) {
\define('MINIMUM_UI_WAIT_TIMEOUT_MILLISEC', 500);
}
if (!\defined('MINIMUM_UI_WAIT_TIMEOUT_MICROSEC')) {
\define('MINIMUM_UI_WAIT_TIMEOUT_MICROSEC', MINIMUM_UI_WAIT_TIMEOUT_MILLISEC * 1000);
}
// Minimum timeout for emails
if (!\defined('EMAIL_WAIT_TIMEOUT_SEC')) {
\define('EMAIL_WAIT_TIMEOUT_SEC', 10);
}
if (!\defined('EMAIL_WAIT_TIMEOUT_MILLISEC')) {
\define('EMAIL_WAIT_TIMEOUT_MILLISEC', EMAIL_WAIT_TIMEOUT_SEC * 1000);
}
// Default number of times to retry where retries are useful
if (!\defined('STANDARD_RETRY_COUNT')) {
\define('STANDARD_RETRY_COUNT', 5);
}
// Minimum number of times to retry where retries are useful
if (!\defined('MINIMUM_RETRY_COUNT')) {
\define('MINIMUM_RETRY_COUNT', 2);
}
// The remote server-under-test might or might not happen to have this directory.
// If it does not exist, then the tests may end up creating it.
if (!\defined('ACCEPTANCE_TEST_DIR_ON_REMOTE_SERVER')) {
\define('ACCEPTANCE_TEST_DIR_ON_REMOTE_SERVER', 'tests/acceptance');
}
// The following directory should NOT already exist on the remote server-under-test.
// Acceptance tests are free to do anything needed in this directory, and to
// delete it during or at the end of testing.
if (!\defined('TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER')) {
\define('TEMPORARY_STORAGE_DIR_ON_REMOTE_SERVER', ACCEPTANCE_TEST_DIR_ON_REMOTE_SERVER . '/server_tmp');
}
// Max HTTP request retry count
if (!\defined('MAX_REQUEST_RETRY_COUNT')) {
\define('MAX_REQUEST_RETRY_COUNT', 10);
}
// Standard request polling interval in seconds
if (!\defined('STANDARD_REQUEST_POLLING_INTERVAL_SEC')) {
\define('STANDARD_REQUEST_POLLING_INTERVAL_SEC', 1);
}
// Seconds to wait before the first search, so that async indexing can complete.
// Polling alone cannot cover this: a search returns as soon as the first result
// is indexed, which would assert against a partially indexed result.
if (!\defined('SEARCH_INDEXING_INITIAL_WAIT_SEC')) {
\define('SEARCH_INDEXING_INITIAL_WAIT_SEC', 3);
}
// Number of times to poll for a service to become ready after a (re)start.
// Polled at STANDARD_REQUEST_POLLING_INTERVAL_SEC, so this allows about a minute.
if (!\defined('SERVICE_READY_RETRY_COUNT')) {
\define('SERVICE_READY_RETRY_COUNT', 60);
}