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

Allow testing any locally loaded extension #48

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,24 @@ Se puede crear una nueva extension entrando al contenedor, activando el entorno
make bash
source venv/bin/activate
ckan -c /app/unckan/ckan.ini generate extension -o /app/unckan/src_extensions/
```
```

## Testear extensiones

Cualquier extension montada localmente en `src_extensions` sera adaptada para que sea posible ser testeada.
Esto se hace en el script `prepare-local-dev-extensions.sh` con la modificacion de su archivo `test.ini`.

Para testear `ckanext-unckan` (o cualquier otra extension) se puede correr el siguiente comando:

```bash
# Entrar al contenedor
make bash
# Activar el entorno virtual
source venv/bin/activate
# Pararse en la carpeta de la extension
cd src_extensions/ckanext-unckan
# o cd src_extensions/ckanext-superset
# Correr los tests
pytest --ckan-ini=test.ini -vv --disable-warnings ckanext/unckan
# o pytest --ckan-ini=test.ini -vv --disable-warnings ckanext/superset
```
15 changes: 6 additions & 9 deletions docker/ckan/files/scripts/prepare-local-dev-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@ do
then
echo "Updating 'test.ini' reference to 'test-core.ini' for plugin $i"
ckan config-tool $i/test.ini "use = config:../../ckan/test-core.ini"
if [ "$i" == "$SRC_EXTENSIONS_DIR/ckanext-uni" ];
then
echo "Updating 'test.ini' to allow testing the extension"
ckan config-tool $i/test.ini "sqlalchemy.url = ${SQLALCHEMY_URL}"
ckan config-tool $i/test.ini "ckan.redis.url = ${CKAN_REDIS_URL}"
ckan config-tool $i/test.ini "solr_url = ${SOLR_URL}"
ckan config-tool $i/test.ini "ckan.datastore.write_url = ${DATASTORE_WRITE_URL}"
ckan config-tool $i/test.ini "ckan.datastore.read_url = ${DATASTORE_READ_URL}"
fi
echo "Updating 'test.ini' to allow testing the extension"
ckan config-tool $i/test.ini "sqlalchemy.url = ${SQLALCHEMY_URL}"
ckan config-tool $i/test.ini "ckan.redis.url = ${CKAN_REDIS_URL}"
ckan config-tool $i/test.ini "solr_url = ${SOLR_URL}"
ckan config-tool $i/test.ini "ckan.datastore.write_url = ${DATASTORE_WRITE_URL}"
ckan config-tool $i/test.ini "ckan.datastore.read_url = ${DATASTORE_READ_URL}"
fi
fi
done
Expand Down
Loading