Skip to content

Commit

Permalink
Merge pull request #48 from unckan/allow_test_all_extensions
Browse files Browse the repository at this point in the history
Allow testing any locally loaded extension
  • Loading branch information
avdata99 authored Dec 15, 2024
2 parents 05f7571 + a95af9d commit 77414f7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
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

0 comments on commit 77414f7

Please sign in to comment.