Hello,

Thanks for the drupal 8 version of the aes module.
I'm the maintener of the dbee module which is has dependency to the aes. Building simple tests for the Drupal 8 version of my module, I got a permanent fatal error on the install of the aes module during simple tests setup. This issue makes impossible the use of simpletest with the aes module enabled.
Message displayed : (drupal v 8.1.10)
The test did not complete due to a fatal error. (Group : Completion check).
Drupal\Core\Config\Schema\SchemaIncompleteException: No schema for aes.settings in Drupal\Core\Config\Testing\ConfigSchemaChecker->onConfigSave() (line 86 of core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php).
Full backtrace :

Drupal\Core\Config\Testing\ConfigSchemaChecker->onConfigSave(Object, 'config.save', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('config.save', Object) (Line: 227)
Drupal\Core\Config\Config->save(1) (Line: 325)
Drupal\Core\Config\ConfigInstaller->createConfiguration('', Array) (Line: 125)
Drupal\Core\Config\ConfigInstaller->installDefaultConfig('module', 'aes') (Line: 75)
Drupal\Core\ProxyClass\Config\ConfigInstaller->installDefaultConfig('module', 'aes') (Line: 248)
Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, 1) (Line: 893)
Drupal\simpletest\WebTestBase->installModulesFromClassProperty(Object) (Line: 561)
Drupal\simpletest\WebTestBase->setUp() (Line: 71)
Drupal\dbee\Tests\DbeeWebTestBase->setUp() (Line: 1046)
Drupal\simpletest\TestBase->run() (Line: 416)
_simpletest_batch_operation(Array, '97', Array)
call_user_func_array('_simpletest_batch_operation', Array) (Line: 252)
_batch_process() (Line: 95)
_batch_do() (Line: 77)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Du to a git issue, I can't make a patch but here is what to be done to kill this issue : tested and it works : declare a mapping for aes.setting even if the settings are store into file and not into database.
Fix below :
Create a new file :config/schema/aes.schema.yml
containing :

# Schema for configuration files of aes module.

aes.settings:
  type: config_entity
  label: 'AES encryption settings'
  mapping:
    cipher:
      type: string
      label: 'encryption cipher'
    mcrypt_iv:
      type: string
      label: 'mcrypt_iv'
    implementation:
      type: string
      label: 'encryption implementation'
    key:
      type: string
      label: 'encryption key'
    msg:
      type: string
      label: 'encryption message'

Comments

thedut created an issue. See original summary.

thedut’s picture

Issue summary: View changes
thedut’s picture

Status: Active » Needs review
dpovshed’s picture

Status: Needs review » Needs work

Dear @thedut, frankly, this seems to be a bit strange to me

1) I doubt the idea that a module in Drupal 8 is obliged to have config file. If testing subsystem demands that, maybe something better to be changed in testing subsystem?
2) You can create a patch as described for example here: https://www.drupal.org/project/aes/git-instructions , there is a section named 'Patching'

thedut’s picture

StatusFileSize
new1.39 KB

Hello Dennis,

Here is a patch adding a simple test for the AES module, simply testing the AES encryption and decryption.
Trying this test, you will lead to the fatal error described in #1.

thedut’s picture

Status: Needs work » Needs review
StatusFileSize
new635 bytes

And this second patch fix the fatal error.
Note that the Inspector module returns errors for the AES module and those errors go away with the patch.

dpovshed’s picture

StatusFileSize
new1.43 KB
new161 bytes

Dear @thedut

I believeattached patch this is a good compromise for your desire of run your Dbee tests and my desire to avoid adding unnecessary components to Aes.

The only fix I added to your test is just appropriate usage of the $strictConfigSchema member variable.

https://api.drupal.org/api/drupal/core!modules!system!src!Tests!Update!U...

Please see an interdiff between patches #5 and #7 for more details.

Please check your tests with only patch #7 and let me know.

andypost’s picture

Status: Needs review » Needs work

Having test in module is great, but schema is required to save config properly and allow it to be used with config _translation module

The proper fix is #6 + #7 (test)

+++ b/config/schema/aes.schema.yml
@@ -0,0 +1,19 @@
+    msg:
+      type: string
+      label: 'encryption message'

Suppose message should be translatable - means type: label

+++ b/src/Tests/AesTests.php
@@ -0,0 +1,53 @@
+  protected $strictConfigSchema = FALSE;

this is a bad idea, without schema saving config could lean to wrong results

andypost’s picture

Also this test should be unittest or kernel test

  • dpovshed committed 2d770ec on 8.x-2.x authored by thedut
    Issue #2805325 by thedut, dpovshed, andypost: aes.settings need defined...
dpovshed’s picture

Status: Needs work » Fixed

Thanks @andypost for your review!

However, let me just commit the simplest way to make this and dependant dbee module work - patch from #7.

I am totally fine if someone decided to rewrite test in kerneltest way, but this is good enough. Approach with

protected $strictConfigSchema = FALSE;

is used successfully in a few other modules as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

thedut’s picture

Hello dpovshed,

Sorry for the late answer.
I confirm that adding
protected $strictConfigSchema = FALSE;
fix my issue.
I have added it to the dbee module.
Thank you.

dpovshed’s picture

@thedut, nice to hear that!

Probably you do not need to add this line to tests in your module, the fact we have it in AES might be enough.

Anyway, thanks for creation the test!