Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/xtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,30 @@ jobs:
KAS_KM1_LOG_FILE: "../../${{ steps.kas-km1.outputs.log-file }}"
KAS_KM2_LOG_FILE: "../../${{ steps.kas-km2.outputs.log-file }}"

- name: Run audit cancel tests
if: ${{ steps.multikas.outputs.supported == 'true' }}
run: >-
uv run pytest
-ra
-v
--html test-results/audit-cancel-${FOCUS_SDK}-${PLATFORM_TAG}.html
--self-contained-html
--audit-log-dir test-results/audit-logs
--sdks-encrypt "${ENCRYPT_SDK}"
--focus "$FOCUS_SDK"
test_audit_cancel.py
working-directory: otdftests/xtest
env:
PLATFORM_DIR: "../../${{ steps.run-platform.outputs.platform-working-dir }}"
PLATFORM_TAG: ${{ matrix.platform-tag }}
PLATFORM_LOG_FILE: "../../${{ steps.run-platform.outputs.platform-log-file }}"
KAS_ALPHA_LOG_FILE: "../../${{ steps.kas-alpha.outputs.log-file }}"
KAS_BETA_LOG_FILE: "../../${{ steps.kas-beta.outputs.log-file }}"
KAS_GAMMA_LOG_FILE: "../../${{ steps.kas-gamma.outputs.log-file }}"
KAS_DELTA_LOG_FILE: "../../${{ steps.kas-delta.outputs.log-file }}"
KAS_KM1_LOG_FILE: "../../${{ steps.kas-km1.outputs.log-file }}"
KAS_KM2_LOG_FILE: "../../${{ steps.kas-km2.outputs.log-file }}"

- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
id: upload-artifact
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vulnerability/tilt_modules/
/xtest/node_modules/
/xtest/tilt_modules/
/xtest/tmp/
/xtest/local.env
/xtest/sdk/js/web/dist/
/xtest/.helm

Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ otdf-sdk-mgr install tip go # Build from source
### Running Tests

```bash
# Configure environment
cd xtest && set -a && source test.env && set +a
# Generate local environment from otdf-local and configure
cd xtest && uv run ../otdf-local env > local.env && set -a && source local.env && set +a

# Run with specific SDK
uv run pytest --sdks go -v
Expand Down Expand Up @@ -247,7 +247,7 @@ yq e '.services.kas.root_key' platform/opentdf-dev.yaml
### Preferred Workflow

1. **Build SDK CLIs**: `cd xtest/sdk && make`
2. **Configure environment**: `cd xtest && set -a && source test.env && set +a`
2. **Configure environment**: `cd xtest && uv run ../otdf-local env > local.env && set -a && source local.env && set +a`
3. **Run tests**: `uv run pytest --sdks go -v`
4. **Restart after config changes**: Restart the affected platform/KAS services

Expand Down
4 changes: 2 additions & 2 deletions otdf-local/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This guide covers operational procedures for managing the test environment with

```bash
cd otdf-local
eval $(uv run otdf-local env) # Sets PLATFORM_LOG_FILE, KAS_*_LOG_FILE, etc.
uv run otdf-local env --format json # Output as JSON
uv run otdf-local env > ../xtest/local.env # Generate local.env
cd ../xtest
set -a && source local.env && set +a # Source the environment
uv run pytest --sdks go -v
```

Expand Down
26 changes: 25 additions & 1 deletion otdf-local/src/otdf_local/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import json
import shutil
import subprocess
import sys
import time
from typing import Annotated
Expand Down Expand Up @@ -607,7 +608,30 @@ def env(
if "version" in config:
env_vars["PLATFORM_VERSION"] = config["version"]
except Exception as e:
print_warning(f"Could not get platform version: {e}")
print_warning(f"Could not get platform version from API: {e}")

# Fall back to git describe if API didn't provide version
if "PLATFORM_VERSION" not in env_vars:
try:
result = subprocess.run(
["git", "describe", "--tags", "--match", "service/v*"],
capture_output=True,
text=True,
cwd=settings.platform_dir,
timeout=5,
)
if result.returncode == 0:
# Parse "service/v0.13.0" or "service/v0.13.0-1-gabcdef"
tag = result.stdout.strip()
if tag.startswith("service/v"):
version = tag[len("service/v") :]
# Strip git describe suffix (e.g. "-1-gabcdef")
parts = version.split("-")
if len(parts) >= 3 and parts[-1].startswith("g"):
version = "-".join(parts[:-2])
env_vars["PLATFORM_VERSION"] = version
except Exception as e:
print_warning(f"Could not get platform version from git: {e}")

# Output in requested format
if format == "json":
Expand Down
Loading
Loading