From d39befa410d040da8272a66794b0c51c4759c99d Mon Sep 17 00:00:00 2001 From: avdata99 Date: Sun, 15 Dec 2024 16:38:29 -0300 Subject: [PATCH 1/2] Allow testing any locally loaded extension --- .../files/scripts/prepare-local-dev-extensions.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/docker/ckan/files/scripts/prepare-local-dev-extensions.sh b/docker/ckan/files/scripts/prepare-local-dev-extensions.sh index 2acdf62..c749ba8 100755 --- a/docker/ckan/files/scripts/prepare-local-dev-extensions.sh +++ b/docker/ckan/files/scripts/prepare-local-dev-extensions.sh @@ -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 From a95af9d783b860de6d23d41ab27036f6deead41c Mon Sep 17 00:00:00 2001 From: avdata99 Date: Sun, 15 Dec 2024 16:42:50 -0300 Subject: [PATCH 2/2] Notas sobre los tests --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db38cef..9fb340b 100644 --- a/README.md +++ b/README.md @@ -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/ -``` \ No newline at end of file +``` + +## 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 +```