Skip to content

Chameleon hardware registration and enrollment service

License

Notifications You must be signed in to change notification settings

ChameleonCloud/doni

Repository files navigation

Unit Tests

doni

Chameleon hardware registration and enrollment service

Development

Dependencies

  • tox: pip install tox

    For running unit tests locally.

  • Docker, Docker Compose

Installing dependencies for IDE (e.g. VSCode)

The setup target will just install all the project runtime and development dependencies into a local virtualenv using Poetry. You can then configure the IDE to point to the .venv directory created by Poetry as your Python interpreter.

make setup

Running unit tests

make test

Adding new DB migrations

Adding a new DB migration is necessary whenever there are changes to the models.py file that, e.g., change, add, or remove a column or constraint. Similarly, a migration is necessary whenever new tables are added.

This can be a bit tricky due to the fact that the local DB uses SQLite, which doesn't have support for some iterative migrations we use. The best procedure is to use the create_schema command to re-create a local SQLite DB from a complete schema at the last recorded state, then have sqlalchemy figure out how to map your changes to a migration via the autogenerate capability.

Here's a step-by-step:

# Stash any local changes to the models.py file
git stash
# Reset the local alembic DB, if any.
rm -f doni/doni.sqlite
# Snapshot the current schema
.venv/bin/doni-dbsync create_schema

# Bring back local changes
git stash pop
# Auto-generate the migration file
.venv/bin/doni-dbsync revision --message "some_description_with_underscores" --autogenerate

About

Chameleon hardware registration and enrollment service

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages