- Status
- runnable in repo test
- Industry
- Cross-industry
- Language
- Bash
- Framework
- DataNivra CLI
- CI
- GitHub Actions matrix
- Fulfilment
- LEASE_CERTIFIED_VERSION
- Profile
- orders-pr-regression
About this example
All data is synthetic. DataNivra provisions approved test data into a customer-controlled target; it does not run these tests. Credentials for the target are never returned by DataNivra — your runner holds its own.
Why test data matters
Many PRs build at once; each needs its own copy of the same certified version.
What is requested
One lease per PR from the same profile.
Policy gates
One live request per pool target; TARGET_POOL_EXHAUSTED (409) when every target is busy.
What is provisioned
Independent copies, one per pool target.
Expected output
Two concurrent requests get two different environment_ids; a fifth concurrent request on a pool of four gets TARGET_POOL_EXHAUSTED.
Cleanup
Each job releases its own request (if: always()); release never revokes the shared version.
Files
request.yamlparallel.sh
Run
- A tenant administrator defines and a second person approves the profile (
datanivra test-data define ../../profiles/orders-pr-regression.yaml --submit, thendatanivra policies approve). datanivra test-data validate request.yaml && datanivra test-data plan request.yaml- Run the example with
DATANIVRA_BASE_URLand a session or workload token.
Files
Exactly as they are in the examples repository. Every value is a synthetic placeholder; nothing here is a credential.
request.yaml
# yaml-language-server: $schema=../../../../packages/contracts/schemas/v1/manifests/test-data-request.schema.json
# DataNivra test-data-request manifest (apiVersion datanivra.io/v1alpha1). Validate: datanivra test-data validate <file>
apiVersion: datanivra.io/v1alpha1
kind: TestDataRequest
metadata:
name: parallel-pr
spec:
profile: { name: orders-pr-regression, version: 1 }
ttl_seconds: 1800
examples/test-data-api/scenarios/19-parallel-pull-requests/request.yaml
parallel.sh
#!/usr/bin/env bash
# Parallel pull requests — each matrix job leases its own copy of the same certified version.
# In GitHub Actions run one job per PR (or matrix entry); every job does:
set -euo pipefail
id=$(datanivra test-data request request.yaml --ci-from-env --wait -o json | jq -r .id)
trap 'datanivra test-data release "$id" --reason-code TEST_RUN_FINISHED' EXIT
datanivra test-data status "$id" -o json | jq '{environment_id, state}' # a different environment per job
./run-integration-tests.sh # your tests, your approved database access
# Exit codes: 24 denied, 25 still pending approval, 26 ended, 27 timed out (see datanivra --help).
examples/test-data-api/scenarios/19-parallel-pull-requests/parallel.sh
The profile it uses: orders-pr-regression
A tenant administrator defines this profile and a second person approves it; requests can only ask for what it allows. All profiles
orders-pr-regression.yaml
# yaml-language-server: $schema=../../../packages/contracts/schemas/v1/manifests/test-data-profile.schema.json
# DataNivra test-data-profile manifest (apiVersion datanivra.io/v1alpha1). Validate: datanivra test-data validate <file>
# Placeholder ids (00000000-0000-4000-8000-0000000000NN): replace with your ids.
# 01 = approved target environment, 11 = certified dataset, 21 = customer agent,
# 99 = workload identity trust (datanivra workload-identities list).
apiVersion: datanivra.io/v1alpha1
kind: TestDataProfile
metadata:
name: orders-pr-regression
description: Certified orders dataset leased into an isolated CI database per pull request
spec:
fulfilment: LEASE_CERTIFIED_VERSION
lease:
dataset_id: 00000000-0000-4000-8000-000000000011
agent_id: 00000000-0000-4000-8000-000000000021
provider_kind: POSTGRESQL_CONTAINER
default_ttl_seconds: 1800
max_ttl_seconds: 7200
target_pool:
- env://DATANIVRA_CI_DB_1
- env://DATANIVRA_CI_DB_2
- env://DATANIVRA_CI_DB_3
- env://DATANIVRA_CI_DB_4
automation:
workload_identity_ids: [00000000-0000-4000-8000-000000000099]
max_ttl_seconds: 3600
max_live_requests: 4
audit_tags: [CI_PULL_REQUEST]