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

Database not available after pressing ctrl-c early in a codecept run #6679

Open
charlesdeb opened this issue Jul 27, 2023 · 0 comments
Open

Comments

@charlesdeb
Copy link

What are you trying to achieve?

Run my tests

What do you get instead?

I pressed control c to stop my tests from running very early in the piece. And now, when I run my tests I see

$ codecept run tests/
Codeception PHP Testing Framework v4.2.2 https://helpukrainewin.org
Powered by PHPUnit 9.5.27 by Sebastian Bergmann and contributors.
^C
$ codecept run tests/acceptance_wpbrowser
Codeception PHP Testing Framework v4.2.2 https://helpukrainewin.org
Powered by PHPUnit 9.5.27 by Sebastian Bergmann and contributors.

In bootstrap.php line 150:
                                                                                                                                                         
  Message: One or more database tables are unavailable. The database may need to be <a href="maint/repair.php?referrer=is_blog_installed">repaired</a>.  
                                                                                                                                                         

run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--phpunit-xml [PHPUNIT-XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--bootstrap [BOOTSTRAP]] [--no-redirect] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--coverage-cobertura [COVERAGE-COBERTURA]] [--coverage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--seed SEED] [--no-artifacts] [--] [<suite> [<test>]]

Presumably I pressed ctrl-c just at the moment that codeception had deleted my wordpress database tables (I'm using it to test wordpress with the lucatume https://github.com/lucatume/wp-browser codeception modification) and hadn't quite rebuilt them.

When I dropped all the artefacts from my test database, and rebuilt the DB with tests/_data/dump.sql it all worked fine again. But it was a bit of a hassle. Is this a problem within codeception, or wp-browser do you think? Seems to me that this should be within a transaction so that if people quit the process, the database can roll back. Unless of course you are using DDL stuff like drop table, truncate table which force an impicit commit.

Details

  • Codeception version: 4.4.2
  • PHP Version: 8.0.29
  • Operating System: ubuntu 22.04
  • Installation type: Composer
  • List of installed packages (composer show)
  • Suite configuration:
# paste suite config here
.  (an extract from the acceptance_wpbrowser.suite.yml file; WPDb very much like codeception's Db config)
.
.
config:
    WPDb:
      dsn: '%TEST_SITE_DB_DSN%'
      user: '%TEST_SITE_DB_USER%'
      password: '%TEST_SITE_DB_PASSWORD%'
      dump: 'tests/_data/dump.sql'
      populate: true
      cleanup: false

Can anything be done about this? Or do I just need to be more careful about pressing ctrl-c?

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

No branches or pull requests

1 participant