Skip to content
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

Add test DB for testing on docker #22

Merged
merged 16 commits into from
Nov 15, 2019

Conversation

waterkip
Copy link
Collaborator

@waterkip waterkip commented Nov 6, 2019

This is a couple of commits that fixes a lot of the testsuite. We still aren't were we want to be, but there is progress.

Test Summary Report
-------------------
t/02config.t       (Wstat: 3840 Tests: 196 Failed: 15)
Failed tests:  32-33, 48-49, 80, 82, 84, 91, 95, 98, 108-109
193-194, 196
Non-zero exit status: 15
t/11talk.t         (Wstat: 256 Tests: 22 Failed: 1)
Failed test:  8
Non-zero exit status: 1
t/database.t       (Wstat: 1024 Tests: 9 Failed: 4)
Failed tests:  3, 7-9
Non-zero exit status: 4
t/dispatcher.t     (Wstat: 1024 Tests: 5 Failed: 4)
Failed tests:  2-5
Non-zero exit status: 4
Files=28, Tests=3405, 17 wallclock secs ( 0.33 usr  0.09 sys + 13.25 cusr  1.10 csys = 14.77 CPU)
Result: FAIL

The original code tested wheter the DB connection could be setup and not
if the code actually did what is what supposed to do. Refactor it so it
tests code written in Act::Database.

This change also eliminates the need for Act::Config as the functions
don't need any configuration, just a database handle which
Test::MockObject now provides to us.
@waterkip waterkip mentioned this pull request Nov 6, 2019
Copy link
Collaborator

@HaraldJoerg HaraldJoerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding new configuration variables: Due to the way Act works, every variable which is used in the code must also be present in the configuration, otherwise you get a warning for every request. Therefore a list of variables must be available at least in the documentation, if not with a comment in act.ini.dist.

@HaraldJoerg
Copy link
Collaborator

HaraldJoerg commented Nov 14, 2019

After some annoying shuffling of directories I got it down to two failing test files:

  • database.t tests whether a failure to connect to the database or a bad version is reported at startup and not at the first web request which happens at sometime later when no one is looking. I'd say such a test makes perfect sense in a docker environment, too, where application and database reside in independent containers. The problem is not with the test suite but with lib/Act/Store/Database.pm, where by commit 1ce96ac the version check just returns undef.
  • dispatcher.t tests whether the URLs offered by the web services are routed to the correct files and handlers. The dispatcher has been changed, so the tests need to be amended accordingly. It appears that Dispatcher.pm needs some care, too, but this is not in scope for this PR.

Related: 89cffdf needs to be reverted with the undoing of the changes in I18N.pm. With a working I18N environment, the "a" element is provided by the .po files and must not be part of the templates.

@waterkip
Copy link
Collaborator Author

waterkip commented Nov 14, 2019

Can you tell me what you have in your act.ini, and what your conference.ini looks like. Because my tests are failing hard on t/02config.t and t/11talk.t.

@HaraldJoerg
Copy link
Collaborator

If you just run t/02config.t in verbose mode, it will tell you which variables are missing. My own setup is pretty customized with four conferences in different languages, among them Russian (for Unicode tests), so 02config.t runs 296 individual tests. The conference configs are pulled from the Act-Conferences repository without changes.
When I run t/02config.t with etc/act.ini.dist, I get two failures for database_pg_dump and database_dump_file (they are needed for the backup script in bin), so maybe you just need to add dummy values. I have:

pg_dump     = 1
dump_file   = /tmp/dbdump

With the same config act.ini.dist, t/11talks.t fails in my setup because it refers to a test database host which I don't have. It would be helpful to know which of the tests are failing: maybe the database setup or cleanup after the tests fails. I have no indication why t/11talks.t should behave different from any other tests using the database, It is using a non-existing conference, so the conference setup should not matter.

@waterkip
Copy link
Collaborator Author

I already found out. My branch was on v10 for DB upgrades and yours is v12. So I added them in
7aa58aa. t/02config keeps failing right now on the the payment type

@waterkip
Copy link
Collaborator Author

Ok, that one is also fixed.

@waterkip
Copy link
Collaborator Author

Exciting times! 👍

$ docker-compose run --rm act prove -l
Starting act_act-wiki-db_1 ... done
Starting act_act-db_1      ... done
t/00-compile.t ....... ok
t/00test.t ........... ok
t/02act.t ............ ok
t/02config.t ......... ok
t/02pod.t ............ ok
t/03database.t ....... ok
t/04i18n.t ........... ok
t/04template.t ....... ok
t/05util.t ........... ok
t/06country.t ........ ok
t/08track.t .......... ok
t/09dbbool.t ......... ok
t/10user.t ........... ok
t/11talk.t ........... ok
t/13participation.t .. ok
t/14order.t .......... ok
t/15events.t ......... ok
t/16timeslot.t ....... ok
t/17invoice.t ........ ok
t/18abstract.t ....... ok
t/19news.t ........... ok
t/20tags.t ........... ok
t/auth_password.t .... ok
t/database.t ......... ok
t/dispatcher.t ....... Use of uninitialized value in subroutine entry at /opt/act/lib/Act/Dispatcher.pm line 149.
t/dispatcher.t ....... skipped: This one fails
t/form.t ............. ok
t/image.t ............ ok
t/mw_errorpage.t ..... ok
All tests successful.
Files=28, Tests=3291, 21 wallclock secs ( 0.27 usr  0.05 sys + 16.55 cusr  1.27 csys = 18.14 CPU)
Result: PASS

@HaraldJoerg HaraldJoerg merged commit bfc229f into act-psgi:master Nov 15, 2019
@waterkip waterkip deleted the act-psgi-act-config-test branch November 15, 2019 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants