quarkus-amazon-services
quarkus-amazon-services copied to clipboard
Cognito user pools with reproducible user pool ids in dev services
The Cognito user pool id is generated randomly when the user pool is created (this is correct as it works like this in AWS also). But this makes it difficult to test if your code depends on a known and existing user pool id (for example if you are fetching the users of a specific user pool in your code).
The dev services for Cognito user pools uses moto for emulating the AWS Cognito behaviour. Moto supports creating the user pool ids with reproducible ids: https://docs.getmoto.org/en/latest/docs/services/cognito-idp.html by setting the MOTO_COGNITO_IDP_USER_POOL_ID_STRATEGY=HASH
environment variable.
When it is enabled, the user pool id will be created based on the input parameters when the pool is created and you should end up with the same user pool id every time as long as the parameters are the same when creating the pool.
That could be added as a configuration option for the devservices/cognito-user-pools
module also.
I would be also interested in implementing this, if you would find this a useful feature.