S3tuit commented on PR #5702:
URL: https://github.com/apache/hop/pull/5702#issuecomment-3335706232

   > I would add a simple integration test in 
https://github.com/apache/hop/tree/main/integration-tests/database ... but I 
feel like perhaps it's going to be hard to enable the extension with `CREATE 
EXTENSION IF NOT EXISTS "uuid-ossp";` in the container.
   
   The error you got in the table view is fixed, before I make another commit I 
want to show you a way we can add unit test for the UUID.
   
   ### Add extension to postgres
   I don't think we actually need `uuid-ossp` since `pgcrypto` provides 
`gen_random_uuid()` and it's more used nowadays. To enable an extension on 
Postgres we can use the `docker-entrypoint-initdb.d` inside postgres image:
   
   ```
     postgres:
     ...
       volumes:
         - 
./database-startup.sql:/docker-entrypoint-initdb.d/01-extensions.sql:ro
   ```
   
   Inside database-startup.sql: `CREATE EXTENSION IF NOT EXISTS pgcrypto;`
   
   ### Test idea
   
   1. Postgres creates a table with UUID column and insert via 
gen_random_uuid(). (Or manual UUID to keep it the same across runs. We don't 
even need extensions with this.)
   2. Read back with the UUIDs, also read the same values cast to VARCHAR, then 
cast back to UUIDs, sort, and join.
   3. Expected a sorted pairs match
   
   If that sounds good, I can add the integration test.
   
   The only thing I don't understand is how do you manage env variable for 
unit-test-db? In the env file there are just 3 variables, and in the 
dev-env-config.json file there's no var for postgres.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to