Selenium tests against the vSphere Client IBM Storage / Datastore Snapshots plugin (shadow DOM + sandbox iframe), plus a dashboard that creates private-lab VMs, deploys or registers a Ceph cluster, and runs those tests.
The dashboard is two processes: the API on port 8000 and the UI on port 3000. Use two terminals. The API process is the one that clones VMs and SSHes to the lab, so the lab passwords have to be exported in that shell.
On the machine that runs the API:
python3 --version
node --version
npm --version
govc version
sshpass -Vgovc clones the guests. sshpass is used for every SSH to cephprireg and the Ceph nodes. On macOS, brew install govc installs govc. Install sshpass as well and confirm both commands are on PATH.
From the repo root:
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .envSkip venv and pip when backend/venv already exists. backend/.env holds API settings such as CORS. It does not supply the lab passwords. Export those in the same terminal before starting the server:
export GOVC_PASSWORD='the vCenter password'
export SSHPASS="$GOVC_PASSWORD"
export REGISTRY_PASSWORD='the cephprireg registry password'
export IBM_ENTITLEMENT_KEY='the IBM entitlement key'GOVC_PASSWORD or SSHPASS is required to create VMs. Deploy also needs REGISTRY_PASSWORD, and IBM_ENTITLEMENT_KEY when the images are copied from cp.icr.io. GOVC_USERNAME defaults to administrator@vsphere.local.
When vCenter 10.64.0.252 has disconnected hosts, clone on the ESXi host instead:
export ESXI_URL='https://<esxi-host>/sdk'
export ESXI_USERNAME='root'cephprireg defaults to 10.64.0.248. Set CEPHPRIREG_HOST when that address is different.
Start the API and leave this terminal open:
uvicorn app.main:app --host 127.0.0.1 --port 8000 --reloadWait for Uvicorn running on http://127.0.0.1:8000. The SQLite file is created at storage/ceph_automation.db. From another terminal:
curl http://127.0.0.1:8000/healthA healthy API returns {"status":"healthy"}. Interactive API docs are at http://127.0.0.1:8000/docs.
In a second terminal, from the repo root:
cd frontend
npm install
npm run devOpen http://localhost:3000. The UI proxies /api to http://localhost:8000. Live logs connect directly to port 8000 on the same host, so leave the API on 8000. If a port is already taken, stop the old process before starting again.
- Infrastructure clones the named template onto
PG-Private-Laband waits for a172.16.200.51–.200address. Enter a vCenter, then pick a datastore from the list that shows capacity and free space. A10.64address on that port group fails the batch. - Clusters deploys
standalone,mirrored,cg_mirrored, orstretchfrom the YUM repo and images you enter, or registers a cluster that is already running. Register checksceph -sand does not create VMs. - Tests and Test Runs run the checked tests or a marker expression against any cluster whose status is
ready. - Test Runs — Mode 1: pick a standalone (or other) cluster, select one or more catalog tests, then start the run. When exactly one test is selected, the UI shows a case config form seeded from that module’s sibling YAML; edits are sent as run-scoped overrides (see
CASE_CONFIG_OVERRIDEbelow). Sibling YAML on disk is never rewritten. - Test Runs — Mode 2 (Run plugin lifecycle): after a standalone cluster is selected, use Refresh storage systems to scrape the live IBM Storage plugin, multi-select systems that have replica pools, set how many datastores to create, then queue create → snapshot → protect → clone in order (add/delete datastore modules are not part of this flow). The run stops on the first failure.
- Results shows pass and fail counts, the selection, and each test’s log and screenshots.
/data/ceph-mirror or /var/www/html/repo must already be mounted on cephprireg. The deploy job does not format a disk. Passwords stay in the shell environment and are redacted from logs.
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with VSPHERE_URL, credentials, host label, default datacenterThis root .env is what the Selenium tests read. The dashboard API does not load these vSphere values. Export GOVC_PASSWORD, SSHPASS, REGISTRY_PASSWORD, and IBM_ENTITLEMENT_KEY in the API terminal, as described above, before creating VMs or deploying Ceph.
For tests/storage_system/test_add_storage_system.py, also set PLUGIN_CLUSTER_USERNAME and PLUGIN_CLUSTER_PASSWORD (Ceph cluster credentials used in the plugin’s Add Storage System wizard). See .env.example.
Each test module test_<name>.py has a sibling test_<name>.yaml with the same basename. That file is loaded automatically when the test runs:
- An autouse fixture fails fast if the YAML is missing.
- Tests receive the parsed dict via the
case_configfixture (addcase_configto the test function parameters).
Secrets and shared URLs stay in .env (src/config.py). Case-specific values (datastore name, snapshot index ranges, clone targets, etc.) belong in the YAML next to the test.
| Module | Config file |
|---|---|
tests/storage_system/test_add_storage_system.py |
test_add_storage_system.yaml |
tests/datastore/test_create_datastore.py |
test_create_datastore.yaml |
tests/snapshot/test_snapshot_lifecycle.py |
test_snapshot_lifecycle.yaml |
tests/snapshot/test_protect_snapshot.py |
test_protect_snapshot.yaml |
tests/clone/test_thin_clone.py |
test_thin_clone.yaml |
tests/delete_datastore/test_delete_datastore.py |
test_delete_datastore.yaml |
tests/snapshot_scale/test_snapshot_scale.py |
test_snapshot_scale.yaml |
tests/clone_scale/test_thin_clone_scale.py |
test_thin_clone_scale.yaml |
tests/snap_protect_scale/test_snap_protect_scale.py |
test_snap_protect_scale.yaml |
tests/datastore_scale/test_datastore_delete_scale.py |
test_datastore_delete_scale.yaml |
Helpers for common keys live in src/case_fields.py.
Five modules cover the standalone plugin flow (@pytest.mark.plugin, @pytest.mark.topology("standalone")). They share navigation via tests/plugin_nav.py and XPath constants in tests/plugin_selectors.py, captured from the live plugin on vCenter 10.64.0.250.
| Step | Module | Notes |
|---|---|---|
| Add storage system | tests/storage_system/test_add_storage_system.py |
Mode 1 only; needs PLUGIN_CLUSTER_* |
| Create VMFS datastore | tests/datastore/test_create_datastore.py |
|
| Snapshot lifecycle | tests/snapshot/test_snapshot_lifecycle.py |
create → revert → delete |
| Protect snapshot | tests/snapshot/test_protect_snapshot.py |
|
| Thin clone | tests/clone/test_thin_clone.py |
The dashboard can pass per-test overrides without changing YAML on disk. When a test run starts, the API may write a JSON file under storage/case_overrides/<run-id>/ and set CASE_CONFIG_OVERRIDE to that path. src/test_case_config.py deep-merges the file on top of the sibling YAML before tests see case_config. Use this from Test Runs Mode 1 (single-test form) or Mode 2 (lifecycle planner). Override files are removed when the run finishes.
Under snapshot, use either:
index_startandindex_end— same semantics as Pythonrange(index_start, index_end)(end exclusive), with names"{name_prefix}{i}", orcountwith optionalindex_start(default1) — createscountsnapshots starting at that index.
pytest tests/delete_datastore/test_delete_datastore.py -v
pytest tests/snapshot_scale/test_snapshot_scale.py -v -m headless- Set
VSPHERE_HEADLESS=1in.envto run all tests headless, or use-m headlesson modules that declare the marker.
| Path | Purpose |
|---|---|
src/config.py |
Environment-backed settings |
src/case_fields.py |
Read/validate keys from case YAML |
src/test_case_config.py |
Load sibling YAML for a test module |
src/auth.py |
vSphere login |
src/source.py |
Developer mode URL + plugin iframe switching |
tests/conftest.py |
Chrome, vsphere_driver, case_config, YAML autouse check |
tests/plugin_nav.py |
IBM Storage tree → datastore → Snapshots nav (lifecycle modules) |
tests/plugin_selectors.py |
XPath constants from lab vCenter 10.64.0.250 |
conf/sample_vmware_config.yaml |
Sample infra (not wired into tests) |
src/source.py defines PluginIframeContext for different plugin-iframe locations. Legacy switchToIframe(driver, True) uses the modal dialog host; False uses the Datastore Snapshots class selector. If a flow breaks after UI changes, try switch_to_plugin_iframe(..., context=PluginIframeContext.GENERIC).