[TASK] Execute functional tests on sqlite db platform 37/57137/17
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 7 Jun 2018 09:50:54 +0000 (11:50 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 8 Jun 2018 12:06:19 +0000 (14:06 +0200)
typo3/testing-framework 3.7.0 supports sqlite db platform
for functional tests. The patch updates the dependency and
adds sqlite functional tests in bamboo pre-merge and nightly.

composer update typo3/testing-framework

typo3DatabaseDriver=pdo_sqlite bin/phpunit -c \
 vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml

There are some know issues already, especially the database
schema analyzer of the install tool behaves weird. However,
this patch is a first step towards sqlite support in the core.

Change-Id: I8e8474dabdf4015a32d3c938adc576fba9b5a5bd
Resolves: #85187
Releases: master
Reviewed-on: https://review.typo3.org/57137
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/bamboo/src/main/java/core/AbstractCoreSpec.java
Build/bamboo/src/main/java/core/NightlySpec.java
Build/bamboo/src/main/java/core/PreMergeSpec.java
composer.lock
typo3/sysext/core/Tests/Functional/Cache/Backend/Typo3DatabaseBackendTest.php
typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php
typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php

index d17f912..43cf2e6 100644 (file)
@@ -73,6 +73,9 @@ abstract public class AbstractCoreSpec {
         " typo3DatabaseHost=\"localhost\"" +
         " typo3InstallToolPassword=\"klaus\"";
 
+    protected String credentialsSqlite =
+        "typo3DatabaseDriver=\"pdo_sqlite\"";
+
     /**
      * Default permissions on core plans
      *
@@ -439,6 +442,52 @@ abstract public class AbstractCoreSpec {
     }
 
     /**
+     * Jobs for sqlite based functional tests
+     *
+     * @param int numberOfChunks
+     * @param Requirement requirement
+     * @param String requirementIdentifier
+     */
+    protected ArrayList<Job> getJobsFunctionalTestsSqlite(int numberOfChunks, Requirement requirement, String requirementIdentifier) {
+        ArrayList<Job> jobs = new ArrayList<Job>();
+
+        for (int i=1; i<=numberOfChunks; i++) {
+            String formattedI = "" + i;
+            if (i < 10) {
+                formattedI = "0" + i;
+            }
+            jobs.add(new Job("Func sqlite " + requirementIdentifier + " " + formattedI, new BambooKey("FSL" + requirementIdentifier + formattedI))
+                .description("Run functional tests on sqlite DB " + requirementIdentifier)
+                .pluginConfigurations(this.getDefaultJobPluginConfiguration())
+                .tasks(
+                    this.getTaskGitCloneRepository(),
+                    this.getTaskGitCherryPick(),
+                    this.getTaskComposerInstall(),
+                    this.getTaskSplitFunctionalJobs(numberOfChunks),
+                    new ScriptTask()
+                        .description("Run phpunit with functional chunk " + formattedI)
+                        .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
+                        .inlineBody(
+                            this.getScriptTaskBashInlineBody() +
+                            "./bin/phpunit --exclude-group not-sqlite --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath + "FunctionalTests-Job-" + i + ".xml"
+                        )
+                        .environmentVariables(this.credentialsSqlite)
+                )
+                .finalTasks(
+                    new TestParserTask(TestParserTaskProperties.TestType.JUNIT)
+                        .resultDirectories("test-reports/phpunit.xml")
+                )
+                .requirements(
+                    requirement
+                )
+                .cleanWorkingDirectory(true)
+            );
+        }
+
+        return jobs;
+    }
+
+    /**
      * Job with integration test checking for valid @xy annotations
      */
     protected Job getJobIntegrationAnnotations() {
index 8377977..2f90f98 100644 (file)
@@ -42,6 +42,7 @@ public class NightlySpec extends AbstractCoreSpec {
     protected int numberOfFunctionalMysqlJobs = 6;
     protected int numberOfFunctionalMssqlJobs = 6;
     protected int numberOfFunctionalPgsqlJobs = 6;
+    protected int numberOfFunctionalSqliteJobs = 10;
     protected int numberOfUnitRandomOrderJobs = 4;
 
     /**
@@ -95,6 +96,8 @@ public class NightlySpec extends AbstractCoreSpec {
 
         jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, this.getRequirementPhpVersion72(), "PHP72"));
 
+        jobsMainStage.addAll(this.getJobsFunctionalTestsSqlite(this.numberOfFunctionalSqliteJobs, this.getRequirementPhpVersion72(), "PHP72"));
+
         jobsMainStage.add(this.getJobUnitJavaScript());
 
         jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion72(), "PHP72"));
index fb14491..8d14cd3 100644 (file)
@@ -50,6 +50,7 @@ public class PreMergeSpec extends AbstractCoreSpec {
     protected int numberOfFunctionalMysqlJobs = 10;
     protected int numberOfFunctionalMssqlJobs = 10;
     protected int numberOfFunctionalPgsqlJobs = 10;
+    protected int numberOfFunctionalSqliteJobs = 10;
     protected int numberOfUnitRandomOrderJobs = 2;
 
     /**
@@ -103,6 +104,8 @@ public class PreMergeSpec extends AbstractCoreSpec {
 
         jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, this.getRequirementPhpVersion72(), "PHP72"));
 
+        jobsMainStage.addAll(this.getJobsFunctionalTestsSqlite(this.numberOfFunctionalSqliteJobs, this.getRequirementPhpVersion72(), "PHP72"));
+
         jobsMainStage.add(this.getJobUnitJavaScript());
 
         jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion72(), "PHP72"));
index 69104a2..2078433 100644 (file)
         },
         {
             "name": "typo3/testing-framework",
-            "version": "3.6.0",
+            "version": "3.7.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/testing-framework.git",
-                "reference": "f22b5936da6886a9197a341aa8b8f4a2c29f05d7"
+                "reference": "a00307acc88ad2ad365932aa67ea73dc90a078f5"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/f22b5936da6886a9197a341aa8b8f4a2c29f05d7",
-                "reference": "f22b5936da6886a9197a341aa8b8f4a2c29f05d7",
+                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/a00307acc88ad2ad365932aa67ea73dc90a078f5",
+                "reference": "a00307acc88ad2ad365932aa67ea73dc90a078f5",
                 "shasum": ""
             },
             "require": {
                 "tests",
                 "typo3"
             ],
-            "time": "2018-06-06T22:30:08+00:00"
+            "time": "2018-06-08T10:33:39+00:00"
         },
         {
             "name": "webmozart/assert",
index 0ece081..74290ec 100644 (file)
@@ -403,6 +403,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function flushByTagWorksWithEmptyCacheTablesWithMysql()
     {
@@ -415,6 +416,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function flushByTagsWorksWithEmptyCacheTablesWithMysql()
     {
@@ -427,6 +429,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function flushByTagRemovesCorrectRowsFromDatabaseWithMysql()
     {
@@ -448,6 +451,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function flushByTagsRemovesCorrectRowsFromDatabaseWithMysql()
     {
@@ -523,6 +527,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function collectGarbageWorksWithEmptyTableWithMysql()
     {
@@ -535,6 +540,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function collectGarbageRemovesCacheEntryWithExpiredLifetimeWithMysql()
     {
@@ -567,6 +573,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function collectGarbageRemovesTagEntriesForCacheEntriesWithExpiredLifetimeWithMysql()
     {
@@ -599,6 +606,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\TestingFramework\Core\Functional\F
      *
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function collectGarbageRemovesOrphanedTagEntriesFromTagsTableWithMysql()
     {
index adb2c30..832b62e 100644 (file)
@@ -162,7 +162,13 @@ class SchemaMigratorTest extends FunctionalTestCase
     }
 
     /**
+     * Disabled on sqlite: It does not support adding a not null column to an existing
+     * table and throws "Cannot add a NOT NULL column with default value NULL". It's
+     * currently unclear if core should handle that by changing the alter table
+     * statement on the fly.
+     *
      * @test
+     * @group not-sqlite
      */
     public function notNullWithoutDefaultValue()
     {
@@ -198,6 +204,7 @@ class SchemaMigratorTest extends FunctionalTestCase
      * @test
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function renameUnusedField()
     {
@@ -231,14 +238,18 @@ class SchemaMigratorTest extends FunctionalTestCase
     }
 
     /**
+     * Disabled on sqlite: It seems the platform is unable to drop columns for
+     * currently unknown reasons.
+     *
      * @test
+     * @group not-sqlite
      */
     public function dropUnusedField()
     {
         $connection = $this->connectionPool->getConnectionForTable($this->tableName);
         $fromSchema = $this->schemaManager->createSchema();
         $toSchema = clone $fromSchema;
-        $toSchema->getTable($this->tableName)->addColumn('zzz_deleted_testfield', 'integer');
+        $toSchema->getTable($this->tableName)->addColumn('zzz_deleted_testfield', 'integer', ['notnull' => false]);
         $statements = $fromSchema->getMigrateToSql(
             $toSchema,
             $connection->getDatabasePlatform()
@@ -279,6 +290,7 @@ class SchemaMigratorTest extends FunctionalTestCase
     /**
      * @test
      * @group not-postgres
+     * @group not-sqlite
      */
     public function installPerformsOnlyAddAndCreateOperations()
     {
@@ -293,7 +305,12 @@ class SchemaMigratorTest extends FunctionalTestCase
     }
 
     /**
+     * Disabled on sqlite: The platform seems to have issues with indexes
+     * for currently unknown reasons. If that is sorted out, this test can
+     * probably be enabled.
+     *
      * @test
+     * @group not-sqlite
      */
     public function installDoesNotAddIndexOnChangedColumn()
     {
@@ -308,6 +325,7 @@ class SchemaMigratorTest extends FunctionalTestCase
      * @test
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function installCanPerformChangeOperations()
     {
@@ -325,6 +343,7 @@ class SchemaMigratorTest extends FunctionalTestCase
      * @test
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function importStaticDataInsertsRecords()
     {
@@ -352,6 +371,7 @@ class SchemaMigratorTest extends FunctionalTestCase
      * @test
      * @group not-postgres
      * @group not-mssql
+     * @group not-sqlite
      */
     public function changeTableEngine()
     {
index 2b969bf..1833e47 100644 (file)
@@ -15,10 +15,12 @@ namespace TYPO3\CMS\Core\Tests\Functional\Error;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
 /**
- * Testcase for class \TYPO3\CMS\Core\Error\ErrorHandler
+ * Test case
  */
-class ErrorHandlerTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
+class ErrorHandlerTest extends FunctionalTestCase
 {
     /**
      * @var array
@@ -34,7 +36,11 @@ class ErrorHandlerTest extends \TYPO3\TestingFramework\Core\Functional\Functiona
     ];
 
     /**
+     * Disabled on sqlite: It does not support init command "SET NAMES 'UTF8'". That's ok
+     * since this test is not about db platform support but error handling in core.
+     *
      * @test
+     * @group not-sqlite
      */
     public function handleErrorFetchesDeprecations()
     {