Skip to content

Commit 09c525c

Browse files
Osticomauretto78riccio82piedicianni
authored
Effective mmt queue (#3425)
* WIP tests * Resumed +60% of test set * Removed obsolete tests * Fixed database sql * Cleaning old code and tests * WIP * Updated dependencies * WIP, more tests * Workin on * More tests - Almost done! * Restored the last test * Fixed wrong file path * Moved new suite in a different folder * Fixed test database default values for datetime * Added tests to CI * Reduced scope build in docker-compose for tests * Updated docker for CI * Depends on build do not works, build explicitly images * Update composer for ci * Try to test outside the container * Try build again * Tests won't work on travis * Injected task_runner in configuration * Removed sql mode from command line * Fixed mysql 8 override sql_mode * Fixed wrong command line mysql * Try bionic builder * Try to fix mysql 5.7 again * Workingb in local with mysql 8 * Exit on mysql schema import * Explicit autoincrement on test. * Specify php 7.4.33 in tests * Fix comment json representation (#3412) * Change shortcuts lib (#3347) * Change shortcuts lib * fix init error * Fix: concordance shortcut * Fix: fix translate shortcut with guess tags active * Update submodule * Update shortcuts * Analyze: update page (#3270) * Analyze: update job table * Analyze: css wip * Analyze: job header * Analyze: job header * Analyze: new details * Analyze: css wip * Analyze: fix outsource label * Analyze: fix outsource label * Fix css z-index label with tooltip component * Analyze: css improvements * Analyze: css improvements * Volume analysis: css fix * Volume analysis: css fix * Analyze: css fix --------- Co-authored-by: pierluigi.dicianni <[email protected]> * Try mysql on local docker instead of travis one * Detach docker * Fixed local mysql host * Fixed issue in tests * Used docker image to run tests * Docker compose up * Added mysql and redis containers for test in docker compose * Fixed exit code from test container * Prepend tests for every build * Fixed tests to work with new code * Try to reduce logs * Fixed jest pollution * Removed error to dev/null * Silent builds * Fixed TMAnalysisWorker and Engines_Results_MyMemory_TMS * All tests now use AbstractTest helper class Signed-off-by: domenico <[email protected]> * Fixed some wrong signatures * Implemented new P4 queue - Refactory toward PHP 7.4 * Updated submodule --------- Signed-off-by: domenico <[email protected]> Co-authored-by: Mauro Cassani <[email protected]> Co-authored-by: Federico Ricciuti <[email protected]> Co-authored-by: pierluigi.dicianni <[email protected]>
1 parent e7f2cb5 commit 09c525c

File tree

466 files changed

+14217
-19115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

466 files changed

+14217
-19115
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ phinx.yml
6464
.lastjobprocessed_jpeer
6565
.maxJobToProcess_jpeer
6666

67-
inc/dqf/dqf_test_secret.ini
68-
6967
mmt_fallback_key.ini
7068

7169
inc/google_translate/mmt_fallback_credentials.json

.travis.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ php:
66

77
branches:
88
only:
9-
# - develop
9+
- develop
1010
- /^v?(\d+\.)?(\d+\.)?(\d+)(-[a-z\d]+)?$/
1111
- freddy
1212
# - master
@@ -27,6 +27,20 @@ before_install:
2727

2828
script:
2929
- |
30+
31+
echo "Load services"
32+
docker-compose -f docker/docker-compose-ci.yml build mysql redis > /dev/null 2>&1
33+
docker-compose -f docker/docker-compose-ci.yml create mysql redis > /dev/null 2>&1
34+
35+
# keep logs for the base node
36+
docker-compose -f docker/docker-compose-ci.yml build base-node
37+
38+
# silent for test node
39+
echo "Build test node"
40+
docker-compose -f docker/docker-compose-ci.yml build test-node > /dev/null 2>&1
41+
42+
# Run tests
43+
docker-compose -f docker/docker-compose-ci.yml up test-node --exit-code-from test-node || exit 1
3044
3145
if [[ ! -z "${TRAVIS_TAG}" ]] ; then
3246

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require-dev": {
3-
"phpunit/phpunit": "^5.0",
3+
"phpunit/phpunit": "^5.7",
44
"robmorgan/phinx": "^0.4.6"
55
},
66
"require": {

docker

inc/Bootstrap.php

+16-6
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@ class Bootstrap {
1818
*/
1919
private $autoLoadedFeatureSet;
2020

21-
public static function start() {
22-
new self();
21+
public static function start( SplFileInfo $config_file = null, SplFileInfo $task_runner_config_file = null ) {
22+
new self( $config_file, $task_runner_config_file );
2323
}
2424

25-
private function __construct() {
25+
private function __construct( SplFileInfo $config_file = null, SplFileInfo $task_runner_config_file = null ) {
2626

2727
self::$_ROOT = realpath( dirname( __FILE__ ) . '/../' );
28-
self::$CONFIG = parse_ini_file( self::$_ROOT . DIRECTORY_SEPARATOR . 'inc/config.ini', true );
28+
29+
if( $config_file != null ){
30+
self::$CONFIG = parse_ini_file( $config_file->getRealPath(), true );
31+
} else {
32+
self::$CONFIG = parse_ini_file( self::$_ROOT . DIRECTORY_SEPARATOR . 'inc/config.ini', true );
33+
}
34+
2935
$OAUTH_CONFIG = @parse_ini_file( self::$_ROOT . DIRECTORY_SEPARATOR . 'inc/oauth_config.ini', true );
3036

3137
register_shutdown_function( [ 'Bootstrap', 'shutdownFunctionHandler' ] );
@@ -52,6 +58,12 @@ private function __construct() {
5258
//get the environment configuration
5359
self::initConfig();
5460

61+
if( $task_runner_config_file != null ){
62+
INIT::$TASK_RUNNER_CONFIG = parse_ini_file( $task_runner_config_file->getRealPath(), true );
63+
} else {
64+
INIT::$TASK_RUNNER_CONFIG = parse_ini_file( self::$_ROOT . DIRECTORY_SEPARATOR . 'inc/task_manager_config.ini', true );
65+
}
66+
5567
ini_set( 'display_errors', false );
5668
if ( INIT::$PRINT_ERRORS ) {
5769
ini_set( 'display_errors', true );
@@ -80,8 +92,6 @@ private function __construct() {
8092
INIT::$CONTROLLER_ROOT = INIT::$ROOT . '/lib/Controller';
8193
INIT::$UTILS_ROOT = INIT::$ROOT . '/lib/Utils';
8294

83-
INIT::$TASK_RUNNER_CONFIG = parse_ini_file( self::$_ROOT . DIRECTORY_SEPARATOR . 'inc/task_manager_config.ini', true );
84-
8595
try {
8696
Log::$uniqID = ( isset( $_COOKIE[ INIT::$PHP_SESSION_NAME ] ) ? substr( $_COOKIE[ INIT::$PHP_SESSION_NAME ], 0, 13 ) : uniqid() );
8797
WorkerClient::init();

lib/Controller/API/NewController.php

-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ public function doAction() {
627627
$projectStructure[ 'mt_engine' ] = $this->postInput[ 'mt_engine' ];
628628
$projectStructure[ 'tms_engine' ] = $this->postInput[ 'tms_engine' ];
629629
$projectStructure[ 'status' ] = Constants_ProjectStatus::STATUS_NOT_READY_FOR_ANALYSIS;
630-
$projectStructure[ 'skip_lang_validation' ] = true;
631630
$projectStructure[ 'owner' ] = $this->user->email;
632631
$projectStructure[ 'metadata' ] = $this->metadata;
633632
$projectStructure[ 'pretranslate_100' ] = (int)!!$this->postInput[ 'pretranslate_100' ]; // Force pretranslate_100 to be 0 or 1

lib/Controller/API/V2/ExportTMXController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function _saveActivity(){
123123
/**
124124
* @Override
125125
*/
126-
public function finalize() {
126+
public function finalize($forceXliff = false) {
127127

128128
$buffer = ob_get_contents();
129129
ob_get_clean();

lib/Controller/API/V3/CountWordController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use API\V2\KleinController;
1313
use CatUtils;
1414
use Langs_Languages;
15-
use LQA\SizeRestriction;
15+
use LQA\SizeRestriction\SizeRestriction;
1616
use Matecat\SubFiltering\MateCatFilter;
1717

1818

lib/Controller/ILegacyCatController.php

-15
This file was deleted.

lib/Controller/createProjectController.php

-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ public function doAction() {
318318
$projectStructure[ 'tms_engine' ] = $this->tms_engine;
319319
$projectStructure[ 'status' ] = Constants_ProjectStatus::STATUS_NOT_READY_FOR_ANALYSIS;
320320
$projectStructure[ 'lang_detect_files' ] = $this->lang_detect_files;
321-
$projectStructure[ 'skip_lang_validation' ] = true;
322321
$projectStructure[ 'pretranslate_100' ] = $this->pretranslate_100;
323322
$projectStructure[ 'pretranslate_101' ] = $this->pretranslate_101;
324323
$projectStructure[ 'dialect_strict' ] = $this->dialect_strict;

lib/Controller/createRandUserController.php

-22
This file was deleted.

lib/Controller/downloadAnalysisReportController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function doAction() {
6666
$analysisStatus = new XTRFStatus( $_project_data, $this->featureSet );
6767
$outputContent = $analysisStatus->fetchData()->getResult();
6868

69-
$this->outputContent = $this->composeZip( $_project_data[0][ 'pname' ], $outputContent );
69+
$this->outputContent = $this->composeZip( $outputContent, $_project_data[0][ 'pname' ] );
7070
$this->_filename = $_project_data[0][ 'pname' ] . ".zip";
7171

7272
/**
@@ -91,7 +91,7 @@ function doAction() {
9191
*
9292
* @return false|string
9393
*/
94-
protected static function composeZip( $projectName , $outputContent ) {
94+
protected static function composeZip( Array $outputContent, $projectName = null, $ignore = false ) {
9595

9696
$fileName = tempnam( "/tmp", "zipmat" );
9797
$zip = new ZipArchive();

lib/Controller/getSpellcheckController.php

-43
This file was deleted.

lib/Controller/getUpdatedTranslationsController.php

-60
This file was deleted.

0 commit comments

Comments
 (0)