0

Hopefully, this will be a simple question.

I am writing a kernel test for a class, called FooConfig, that reads from a configuration file. For the purpose of facilitating this test, I need a configuration YAML file that exists purely for testing.

So the question is: is it best practice for this configuration file to live under config/install, or should it exist within the /tests directory?

  • One way is to create a small testing module that contains specific config you need for a test, then have the test use it as a dependency. In my case, I put that module itself under the tests directory and marked it as hidden in its info file. – Kevin Sep 18 at 16:17
  • Now why didn't I think of that. :) This is technically the answer, so if you would like to post this as an answer, I can mark it as correct. – Beau Sep 18 at 21:00
2

One way is to create a small testing module that contains specific config you need for a test, then have the test use it as a dependency. In my case, I put that module itself under the tests directory and marked it as hidden in its info file.

Although a drawback would be keeping these config files up to date when the system changes - but failing tests should point you in that direction too.

For Kernel tests be sure to call and install the test modules config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.