Skip to content

Commit b82b4df

Browse files
committed
Introduce README for app tests
1 parent c6e6564 commit b82b4df

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

app-tests/README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# OPAL Application Tests
2+
3+
To fully test OPAL's core features as part of our CI flow,
4+
We're using a bash script and a docker-compose configuration that enables most of OPAL's important features.
5+
6+
## How To Run Locally
7+
8+
### Controlling the image tag
9+
10+
By default, tests would run with the `latest` image tag (for both server & client).
11+
12+
To configure another specific version:
13+
14+
```bash
15+
export OPAL_IMAGE_TAG=0.7.1
16+
```
17+
18+
Or if you want to test locally built images
19+
```bash
20+
make docker-build-next
21+
export OPAL_IMAGE_TAG=next
22+
```
23+
24+
### Using a policy repo
25+
26+
To test opal's git tracking capabilities, `run.sh` uses a dedicated GitHub repo ([opal-tests-policy-repo](https://github.com/permitio/opal-tests-policy-repo)) in which it creates branches and pushes new commits.
27+
28+
If you're not accessible to that repo (not in `Permit.io`), Please fork our public [opal-example-policy-repo](https://github.com/permitio/opal-example-policy-repo), and override the repo URL to be used:
29+
```bash
30+
export [email protected]:your-org/your-repo.git
31+
```
32+
33+
As `run.sh` requires push permissions, and as `opal-server` itself might need to authenticate GitHub (if your repo is private). If your GitHub ssh private key is not stored at `~/.ssh/id_rsa`, provide it using:
34+
```bash
35+
# Use an absolute path
36+
export OPAL_POLICY_REPO_SSH_KEY_PATH=$(realpath ./your_github_ssh_private_key)
37+
```
38+
39+
40+
### Putting it all together
41+
42+
```bash
43+
make docker-build-next # To locally build opal images
44+
export OPAL_IMAGE_TAG=next # Otherwise would default to "latest"
45+
46+
export [email protected]:your-org/your-repo.git # To use your own repo for testing (if you're not an Permit.io employee yet...)
47+
export OPAL_POLICY_REPO_SSH_KEY_PATH=$(realpath ./your_github_ssh_private_key) # If your GitHub ssh key isn't in "~.ssh/id_rsa"
48+
49+
cd app-tests
50+
./run.sh
51+
```

app-tests/docker-compose-app-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
environment:
1616
- OPAL_BROADCAST_URI=postgres://postgres:postgres@broadcast_channel:5432/postgres
1717
- UVICORN_NUM_WORKERS=4
18-
- [email protected]:permitio/opal-tests-policy-repo.git
18+
- OPAL_POLICY_REPO_URL=${OPAL_POLICY_REPO_URL:-[email protected]:permitio/opal-tests-policy-repo.git}
1919
- OPAL_POLICY_REPO_MAIN_BRANCH=${POLICY_REPO_BRANCH}
2020
- OPAL_POLICY_REPO_SSH_KEY=${OPAL_POLICY_REPO_SSH_KEY}
2121
- OPAL_DATA_CONFIG_SOURCES={"config":{"entries":[{"url":"http://opal_server:7002/policy-data","config":{"headers":{"Authorization":"Bearer ${OPAL_CLIENT_TOKEN}"}},"topics":["policy_data"],"dst_path":"/static"}]}}

0 commit comments

Comments
 (0)