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

[qa] Use a separate database for migration checks #186

Open
pandafy opened this issue May 7, 2021 · 1 comment
Open

[qa] Use a separate database for migration checks #186

pandafy opened this issue May 7, 2021 · 1 comment
Labels
enhancement Hacktoberfest Easy issues for attracting Hacktoberfest participants.

Comments

@pandafy
Copy link
Member

pandafy commented May 7, 2021

Performing migration checks on user's database sometimes leads to tests failing for sample app of the module.

Here is an example of running migration checks on openwisp-controller

$ SAMPLE_APP=1 openwisp-qa-check \
SAMPLE_APP=1 openwisp-qa-check \
>   --migration-path "./tests/openwisp2/sample_config/migrations/
>                     ./tests/openwisp2/sample_pki/migrations/
>                     ./tests/openwisp2/sample_connection/migrations/
>                     ./tests/openwisp2/sample_geo/migrations/"
SUCCESS: Blank endline check successful!
SUCCESS: Migration name check on "./tests/openwisp2/sample_config/migrations/" with migrations-to-ignore: 0 successful!
SUCCESS: Migration name check on "./tests/openwisp2/sample_pki/migrations/" with migrations-to-ignore: 0 successful!
SUCCESS: Migration name check on "./tests/openwisp2/sample_connection/migrations/" with migrations-to-ignore: 0 successful!
SUCCESS: Migration name check on "./tests/openwisp2/sample_geo/migrations/" with migrations-to-ignore: 0 successful!
SUCCESS: Isort check successful!
SUCCESS: Black check successful!
SUCCESS: Flake8 check successful!
SUCCESS: ReStructuredText check successful!
SUCCESS: Commit message check successful!
Traceback (most recent call last):
  File "tests/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/core/management/commands/makemigrations.py", line 101, in handle
    loader.check_consistent_history(connection)
  File "/home/pandafy/openwisp/venv-controller/lib/python3.8/site-packages/django/db/migrations/loader.py", line 295, in check_consistent_history
    raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration account.0001_initial is applied before its dependency sample_users.0001_initial on database 'default'.

We should check if we can use an in-memory database for performing these checks

@pandafy pandafy assigned pandafy and unassigned pandafy May 7, 2021
@nemesifier
Copy link
Member

If we can't find a way to define the in-memory DB we could also provide a slightly different setting file which specifies an alternative sqlite DB.

@nemesifier nemesifier added the Hacktoberfest Easy issues for attracting Hacktoberfest participants. label Oct 1, 2021
@nemesifier nemesifier moved this to To do (Python & Django) in OpenWISP Contributor's Board Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Hacktoberfest Easy issues for attracting Hacktoberfest participants.
Projects
Status: To do (Python & Django)
Development

No branches or pull requests

2 participants