An open API service indexing awesome lists of open source software.

https://github.com/inferadb/tests

InferaDB E2E tests — Engine and Control in Kubernetes
https://github.com/inferadb/tests

access-control authorization docker e2e-testing fine-grained-access-control helm inferadb integration-testing kubernetes permissions rebac rust zanzibar

Last synced: 3 months ago
JSON representation

InferaDB E2E tests — Engine and Control in Kubernetes

Awesome Lists containing this project

README

          


InferaDB Logo


InferaDB Integration Tests



Discord
License


E2E tests for Engine and Control with Ledger storage


> [!IMPORTANT]
> Under active development. Not production-ready.

## Quick Start

There are two ways to run the E2E tests:

### Option 1: Docker Compose (CI-friendly)

Use this for CI pipelines or when you don't have a K8s cluster:

```bash
# From the meta-repository root
docker compose -f docker-compose.e2e.yml up -d

# Run tests
cd tests
cargo test --test integration -- --test-threads=1

# Stop and cleanup
docker compose -f docker-compose.e2e.yml down -v
```

Or use the helper script:

```bash
./run-e2e.sh # Run all tests
./run-e2e.sh --keep # Keep containers running after tests
./run-e2e.sh cache # Run only cache-related tests
```

### Option 2: Kubernetes Development Cluster

Use this for development with the full Tailscale-based setup:

```bash
# Check prerequisites
inferadb dev doctor

# Start development cluster
inferadb dev start

# Run tests
cargo test --test integration -- --test-threads=1

# Stop cluster (preserves data)
inferadb dev stop

# Destroy cluster completely
inferadb dev stop --destroy
```

Run specific suites:

```bash
cargo test --test integration auth_jwt -- --test-threads=1
cargo test --test integration vault_isolation -- --test-threads=1
cargo test --test integration cache -- --test-threads=1
cargo test --test integration ledger_cache_invalidation -- --test-threads=1
```

## Test Coverage

| Category | Tests | Scope |
| ------------------------- | ----- | ----------------------------------------------- |
| Authentication | 7 | JWT validation, Ed25519, expiration, scopes |
| Vault Isolation | 4 | Multi-tenant separation, cross-vault prevention |
| Cache Behavior | 4 | Hit/miss patterns, expiration, concurrency |
| Ledger Cache Invalidation | 4 | Ledger watch, certificate revocation, writes |
| Concurrency | 5 | Parallel requests, race conditions |
| E2E Workflows | 2 | Registration → authorization flows |
| Management | 5 | Org suspension, client deactivation |
| Resilience | 6 | Recovery, degradation, error propagation |

## CLI Commands

The development cluster is managed via the [InferaDB CLI](https://github.com/inferadb/cli):

| Command | Purpose |
| ----------------------------- | ------------------------------- |
| `inferadb dev doctor` | Check development prerequisites |
| `inferadb dev start` | Start local Talos cluster |
| `inferadb dev stop` | Pause cluster (preserves data) |
| `inferadb dev stop --destroy` | Destroy cluster and data |
| `inferadb dev status` | Show cluster status |
| `inferadb dev logs` | View cluster logs |
| `inferadb dev reset` | Reset all cluster data |

## Environment

Tests use K8s service DNS. Override for local development:

| Variable | Default (in K8s) | Purpose |
| ----------------- | ------------------------------ | --------------------- |
| `CONTROL_URL` | `http://inferadb-control:9090` | Control HTTP endpoint |
| `ENGINE_URL` | `http://inferadb-engine:8080` | Engine HTTP endpoint |
| `ENGINE_GRPC_URL` | `http://inferadb-engine:8081` | Engine gRPC endpoint |
| `ENGINE_MESH_URL` | `http://inferadb-engine:8082` | Engine mesh endpoint |

## Writing Tests

```rust
#[tokio::test]
async fn test_my_feature() {
let fixture = TestFixture::create().await.expect("setup failed");
let jwt = fixture.generate_jwt(None, &["inferadb.check"]).unwrap();

let response = fixture
.call_engine_evaluate(&jwt, "document:1", "viewer", "user:alice")
.await
.unwrap();

assert_eq!(response.status(), StatusCode::OK);
}
```

## Troubleshooting

| Issue | Solution |
| --------------------- | -------------------------------------------------------------------------------------- |
| Services not starting | `inferadb dev status` or `inferadb dev logs` |
| Port in use | `inferadb dev stop --destroy && inferadb dev start` |
| Tests timing out | Ensure Docker has 4GB+ RAM; check `inferadb dev logs` |
| Prerequisites missing | Run `inferadb dev doctor` to check requirements |

## Community

Join us on [Discord](https://discord.gg/inferadb) for questions, discussions, and contributions.

## License

Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE).