Hello, team! What's the best approach to work with...
# permit-saas
u
Hello, team! What's the best approach to work with Permit.io in the test environment? I do not understand properly what the recommended approach is, depending on mau and so on. Should we mock PDP for tests, or create a specific test environment, or something else? Thanks!
a
Hi @Uladzislava Sheleh, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
a
The recommended approach is to create dedicated test environments within Permit.io's hierarchy structure (1) (2) . Permit.io supports an environment-project model where each project has a default of
Production
and
Development
environments, but you can create as many as you want (2) . This structure allows you to manage your CI/CD process in the same way you manage it in your SDLC . For testing workflows, you can: ​*Create isolated test environments*​ - Each environment is independent yet can replicate production settings, making it ideal for testing and development . Permission management is consistent across environments, ensuring that your CI/CD process is both secure and reliable . ​*Run tests against a local PDP*​ - You can run the PDP locally using Docker for testing purposes (3) (2) :
Copy code
docker run -it \
 -p 7766:7000 \
 --env PDP_API_KEY=<your-permit-api-key> \
 --env PDP_DEBUG=True \
 permitio/pdp-v2:latest
(3) Then configure your SDK to point to the local PDP:
Copy code
from permit import Permit

permit = Permit(
 token="[your-api-key]",
 pdp="<http://localhost:7766>",
)
​*Automate environment creation for PRs*​ - For each pull request, you can automate the process of creating a new Permit environment, running integration and product tests against it, and then merging changes into production (2) . The environment model provides flexibility and control across multiple stages of development, allowing isolated environments with seamless permission management .
To learn more, see the sources I considered: [[1] How does Permit.io work?](https://docs.permit.io/overview/how-does-it-work) [[2] How Custom GitHub Actions Enabled Us to Streamline Thousands of CI/CD Pipelines](https://www.permit.io/blog/streamline-cicd-with-custom-github-actions) [[3] Permit's PDP (Policy Decision Point)](https://docs.permit.io/concepts/pdp/overview)