Unittests failing


There are two unittests failing with the same error: key [DSN] doesn't exist. I've included an HTML file with the unittest results, and full stacktraces.




Brad Wood
July 10, 2018, 6:57 PM

You can just attach it here. Thanks.

Ben Ferdinandus
July 11, 2018, 9:43 AM

Hi Brad, I double checked that I am using the latest code. See the attached screenshot.

I still had unittest errors, One item in tests.specs.ConfigServiceTest and both the whole tests.specs.Railo4ServerConfigTest and tests.specs.Railo4WebConfigTest are failing. See the attached HTML file.

For the failing Railo tests I think these files seem to be missing:

  • /tests/resources/railo4/serverHome/Railo-Server/context/railo-server.xml

  • /tests/resources/railo4/WebHome/railo-web.xml.cfm

Are those added to the repo and to the /tests/resources/.gitingore exclude list?

I made the failing test in tests.specs.ConfigServiceTest (can transer config from adobe to Lucee) working by manually copying the neo-cron.xml from tests/resources/adobe11/serverHome/WEB-INF/cfusion/lib/neo-cron.xm to tests/resources/tmp/adobe/lib/neo-cron.xml It seems that this file is skipped when transferring settings from JSON to Adobe, when there are no scheduled tasks defined in the .CFConfig.json. If I add the "scheduledTasks":{}, property to the tests/resources/CFConfig.json, the tests succeeds again.

It might be an idea to clean the folder tests/resources/tmp before running the tests. That way you can find out when files are not generated during the transfer tests.

Brad Wood
July 11, 2018, 3:01 PM

Right, so the Railo support is brand new and was added by Mark Drews via a pull. There are supposed to be config files for every supported engine in /tests/sources but I'm guessing those just got missed. The quick and easy fix for you is simply to cd into the folder for the Railo server (with the server.json) and run a `start` command. That will create all of those config files for you. I'll check and see why they aren't committed to the repo.

As far as the neo-cron file not being there. That is probably a case of sloppy assumptions in the test cases. CFConfig won't write a file if there is no config to be written to that file. The tmp folder is used for all sorts of random stuff during the tests and it's probably not a safe assumption that whatever is written there has 100% of the files to make it able to be read from. I could loosen the validation to just ignore missing files, but a "real" CF installation wouldn't (and shouldn't) have missing files so I'm not sure that's the correct solution. A better fix might be to just repoint that tests at one of the 'real' server roots that have all the files in them.

As far as deleting the tmp folder between runs, yes you are correct and the code used to do that. However, there was a regression around CommandBox 3.7 that was causing files in the web root of servers to get locks on them in Windows which gave me no end of errors when trying to delete folders inside of unit tests so I had stopped deleting it. That regression has been fixed in CommandBox 4.0 so I should be able to go back to deleting that folder on every run.

Brad Wood
July 11, 2018, 3:38 PM

Ok, I updated the gitignores to commit the Railo config files:

I added scheduled tasks to the default config JSON file

And I reinstated the code that deletes the tmp folder between test runs:

Ben Ferdinandus
July 12, 2018, 6:58 AM

that's great. Works like a charm.

Just to let you know, I'm working on adding the gateway support.

Thank you for the help.



Brad Wood


Ben Ferdinandus