بنقرة واحدة
testing
Run ORC tests (unit tests, linting, and E2E tests). Use after making changes to verify correctness.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Run ORC tests (unit tests, linting, and E2E tests). Use after making changes to verify correctness.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Review ORC controller code for Kubernetes best practices and ORC conventions. Use after implementing or modifying a controller.
Add a dependency on another ORC resource to a controller. Use when a resource needs to reference or wait for another resource (e.g., Subnet depends on Network).
Create a new ORC controller for an OpenStack resource. Use when adding support for a new OpenStack resource type (e.g., LoadBalancer, FloatingIP).
Write an enhancement proposal for a new ORC feature. Use for significant new features, breaking changes, or cross-cutting architectural changes.
Update an existing ORC controller. Use when adding fields, making fields mutable, adding tag support, or improving error handling.
Draft release notes for a new ORC version. Use when preparing a release to generate changelog and GitHub release body from git history.
| name | testing |
| description | Run ORC tests (unit tests, linting, and E2E tests). Use after making changes to verify correctness. |
| disable-model-invocation | true |
Run unit tests, linting, and E2E tests for ORC controllers.
Before running E2E tests, ensure code compiles and passes linting:
make generate
make lint
make test
E2E tests require E2E_OSCLOUDS environment variable pointing to a clouds.yaml file containing cloud entries for regular and admin credentials. The cloud names are configurable via environment variables:
| Variable | Description | Default |
|---|---|---|
E2E_OSCLOUDS | Path to clouds.yaml | /etc/openstack/clouds.yaml |
E2E_OPENSTACK_CLOUD_NAME | Cloud name for regular credentials | devstack |
E2E_OPENSTACK_ADMIN_CLOUD_NAME | Cloud name for admin credentials | devstack-admin-demo |
If the user did not provide E2E_OSCLOUDS, tell them local E2E testing will be skipped and they should run it manually later or in CI.
If E2E_OSCLOUDS is provided, execute each step in order:
Step 1: Create kind cluster (if not already running)
# Check if cluster exists
kind get clusters
# Create only if no cluster exists
kind create cluster
If a cluster already exists, skip creation and proceed to Step 2.
Step 2: Verify cluster is ready
kubectl get nodes
Ensure node shows Ready status.
Step 3: Install CRDs
kubectl apply -k config/crd --server-side
Step 4: Stop any existing manager, rebuild, and start
# Stop any existing manager to ensure we're running latest code
pkill -f orc-manager || true
# Build and start fresh
go build -o /tmp/orc-manager ./cmd/manager
/tmp/orc-manager -zap-log-level 5 > /tmp/manager.log 2>&1 &
Step 5: Wait for manager to start and verify it's running
sleep 5
ps aux | grep "[o]rc-manager"
If no process found, check /tmp/manager.log for errors.
Step 6: Run E2E tests
Replace /path/to/clouds.yaml with the actual path and <kind> with the controller name:
E2E_OSCLOUDS=/path/to/clouds.yaml E2E_KUTTL_DIR=internal/controllers/<kind>/tests make test-e2e
Step 7: If tests fail, review manager logs
# Search for errors first (logs are verbose at level 5)
grep -i error /tmp/manager.log | tail -50
# Or view more context
tail -500 /tmp/manager.log
Use these logs to diagnose and fix issues, then re-run the tests.
Step 8: Cleanup After tests pass (or when done debugging):
pkill -f "orc-manager" || true
kind delete cluster
rm -f /tmp/manager.log /tmp/orc-manager
Tests are located in internal/controllers/<kind>/tests/:
| Directory | Purpose |
|---|---|
<kind>-create-minimal/ | Create with minimum required fields |
<kind>-create-full/ | Create with all fields |
<kind>-import/ | Import existing resource |
<kind>-import-error/ | Import with no matches |
<kind>-dependency/ | Test dependency waiting and deletion guards |
<kind>-import-dependency/ | Test import with dependency references |
<kind>-update/ | Test mutable field updates |