-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starting a test framework #336
Conversation
I don't know the best way, but use of One idea is defining %Conf::Conf = (
domain => 'lists.example.com', # mandatory
listmaster => 'dude@example.com', # mandatory
lang => 'en-US',
db_type => 'SQLite',
db_name => 't/dummy_data/sympa',
); |
Good idea! It has the added value of restricting configuration for each module to what is strictly necessary. |
Done! |
Data in t/ directory is by definition dummy data, so please rename the directory to data or something equally appropriate. |
Nitpicker... ;-) |
Conf.t fails when I run it from my repo. Also if you have no compelling reason for using numbers in the test file names, please drop them.
|
Yes I have reasons for using numbers: I want some modules to be tested first. Conf.pm is everywhere, so any bug must be spotted first. Seeing it in error at the top of the list will help debugging process. |
OK. I generated the config file on server on which Sympa is installed. I'l remove it and test it blankly. |
…ng all path in sympa.conf pointing to t/data/.
It needed an |
There is no reason for adding an arbitrary file for keeping a directory in Git: https://wiki.linuxia.de/library/stefan-hornburg-racke-git-cheatsheet-en#text-amuse-label-emptyfolder |
Ok, the test is now successful 👍 It would be nice though to get rid of the following Sympa message:
|
About .gikeep. I found the follwing argument convincing (prevent confusion with actual gitignore) : https://stackoverflow.com/questions/7229885/what-are-the-differences-between-gitignore-and-gitkeep/7229996#7229996 |
About the message : it is not in the test, ins't it? Only in Sympa logs? |
About the overall test success : Cool! ;-) |
This argument doesn't convince me. In my opinion it is better to use existing techniques (.gitignore) instead of inventing workarounds (kind of like poor man's backups). Please change. |
|
Weird:
|
I'll add a dummy auth.conf file anyway (which also solves the .gitkeep issue ;-) ) |
But I'll use .gitignore if you'd rather see this. |
… only a fix to have the test run smoothly. In a near future, it should be fixed in Sympa, by making use of default when the file is missing.
So I added the auth.conf file. This is not an actual fix of Sympa code, but as it is not the purpose of the current PR, I won't touch anything in Sympa code. Only in tests. |
Good 👍 |
Cool! |
@ikedas What do you think? |
I’ll check tomorrow. |
@ikedas : They probably should, as all other test files are in Makefile.am too. Do you want me to add them? |
I checked with:
Yes please. they are occasionally missed, and discovered during release work. 😉 |
Hi @ikedas , and thanks for taking the time to review my work! Agreed for the database file name. I'll change it to sympa.sqlite. Agreed also for the parameter. Indeed, basing a test on a parameter with a default hard-coded value was kind of dumb from me... I'll also update the Makefile.am. Regards, David |
A little addition: I will create a test file in the xt/ directory to test the script used to populate the test database... Looks like the good place to do it. |
Fuck. The Travis CI fails. I'll check what's wrong and fix. |
Weird. Everything is working like a charm at home. |
Yay, it's fixed! |
I added a dummy (and empty) SQLite database and a dummy sympa.conf file.
These are used in a test file for Conf.pm and another one for Sympa::DatabaseManager.
These two modules should be tested first (hence the number for the test files). Providing everything works, we can start testing other files, being sure that they will be allowed to access our dummy database and configuration.
Of course, it is just a start: still more work to populate the database, being able to empy it and repopulate it easily, and also using ll configs: auth.conf, lists configs, etc.