Development¶
Local testing¶
Local testing uses the same set-up as other DANS microservices.
Database for testing¶
Although this project can use an HSQLDB database, this will only work for very trivial scenarios, due to limitations with respect to the BLOB type. It is therefore recommended to use a PostgreSQL database, possibly on a vagrant VM.
Prepare the database for testing (on the vagrant VM):
sudo -u postgres psql
CREATE DATABASE dd_data_vault_local_test;
CREATE USER dd_data_vault_local_test WITH PASSWORD 'dd_data_vault_local_test';
GRANT ALL PRIVILEGES ON DATABASE dd_data_vault_local_test TO dd_data_vault_local_test;
\q
Testing with dmftar
¶
To test scenarios in which dmftar
is used, install this command in a Python virtual environment:
git submodule update
to get the correct version of the dmftar source code.python3 -m venv .venv
to create a virtual environment.source .venv/bin/activate
to activate the virtual environment.pushd modules/dmftar
to change directory to the dmftar source code.pip3 install -r requirements.txt
to install the dmftar dependencies.`flit install
to install the dmftar command.popd
to return to the root of the project.
(You could also use pip3 install -e .
instead of flit
, if you want to edit the source code, but that is not necessary).
Note that your public key must be added to the SURF Data Archive account used for testing.