Repository navigation
feat(v2): E2E testing - #101
Conversation
7f199b7 to
10fdb2b
Compare
vvaldez
left a comment
There was a problem hiding this comment.
@sabre1041 Dual code review (secops + devops, independent passes) of this draft. Two blocking items, then coaching items. Verdict: NOT READY to un-draft yet — the BLOCKs are small fixes.
Blocking Findings
[BLOCK] roles/e2e_testing/tasks/run_openshift_cluster_vm_source.yml:3-13 — Verify Migration Request assert fires on the default value.
e2e_testing_openshift_plans_request defaults to {} (defaults/main.yml:62), so | default('', true) | length > 0 is false and the assert aborts every invocation of this entry point — including the registry-credentials-only path the file is structured to support. The Configure Plans block (line 47) was deliberately written to skip when empty; the assert contradicts it.
Fix: drop the assert (rely on the block's when:), or make the request truly required (argument spec required: true) and delete the when: guard. Pick one contract.
[BLOCK] roles/e2e_testing/defaults/main.yml:38-42 + meta/argument_specs.yml:39-46 — e2e_testing_verify_ssl type mismatch / silent TLS-off.
A bool-typed option is fed by a raw env string through a >- folded Jinja block, and the README contradicts itself (line 81: Type: bool, line 110: Type: str). Worse, there is no coupling check between verify_ssl=false and ca_cert_path: an operator env of K8S_AUTH_VERIFY_SSL=false + a stray K8S_AUTH_SSL_CA_CERT silently disables certificate verification against the API endpoint. For a tool that drives real migrations, silent TLS-off is blocking.
Fix: coerce with | bool at the end of the cascade; add an assert before the first k8s call in namespace_prepare.yml rejecting the ambiguous pair; regenerate the README so both sections say bool.
Coaching Items (pre-submission — no issues filed)
[HIGH] Destructive-by-default, no guardrail — playbooks/vmf_e2e_testing.yml:67-81 + run_openshift_cluster_vm_source.yml:91-141. A successful run migrates real VMs, then archives and deletes the plan (e2e_testing_archive_plan/e2e_testing_delete_plan both default true). Target is chosen purely by inventory wiring; a wrong K8S_AUTH_HOST or aap_hosts entry runs the whole flow against the wrong cluster, and --check does not stop wait: true job launches. Suggest: default archive/delete to false; add an explicit opt-in or target-allowlist assert (e2e_testing_openshift_host must be in a sanctioned list) before namespace_prepare.
[HIGH] aap_password in hostvars via add_host — playbooks/vmf_e2e_testing.yml:21-31. add_host binds the AAP password (and username) as persistent hostvars on the dynamic aap_* hosts for the rest of the run — in scope for every subsequent play, including import_playbook: vmf_seed_aap.yml and the transitive task graph of infra.aap_configuration.controller_job_launch (an external collection). Any hostvars rendering there leaks the password. Suggest: read the credential at task time from its original source instead of add_host, or at minimum audit controller_job_launch for hostvars rendering and scope no_log.
[MEDIUM] Registry creds in AAP extra_vars — roles/e2e_testing/tasks/configure_vddk_credentials.yml:31-32. AAP persists extra_vars on the Job record (visible to all org members with job-read), so the secret's lifetime extends to job-record retention. I verified the downstream utility_registry_credentials role does no_log on its k8s task, so log exposure is mitigated. Suggest: prefer an AAP credential for registry auth; if extra_vars are kept, document the exposure.
[MEDIUM] Hardcoded AAP job-template display names — roles/e2e_testing/vars/main.yml:3-7. Display name → job template is the dispatch trust boundary for destructive launches. Note: infra.aap_configuration is a pre-existing dependency (used by mtv_hook_invoke_aap) and is currently commented out in galaxy.yml — so this isn't new, but it becomes load-bearing here. Suggest: launch by ID or assert org+name resolution; document that names must match the seeded AAP (likely via aap_seed).
[MEDIUM] Zero tests — for a role that drives real cluster migrations. The env-var cascades in defaults/main.yml are pure Jinja and trivially unit-testable; a mock of controller_job_launch could assert the job structure. Suggest: add cascade unit tests + a mock-based job-structure test in this PR; document the manual E2E procedure in the README.
Notes
roles/e2e_testing/tasks/main.ymlis an empty entry point —include_rolewithouttasks_fromis a silent no-op. Add a comment or make it a real orchestrator.playbooks/vmf_e2e_testing.yml:41-47vs:61-63— the two plays test opposite directions of theaap_hostsrelationship. One is likely wrong; verify howaap_hostsis populated.playbooks/vmf_e2e_testing.yml:18-31— if the resolvedutility_clustersgroup has no members, play 3 silently matches zero hosts andmigration_aapstays empty; downstream plays no-op. Assert the group is non-empty after play 1.- PR title
feat(v2): E2E testing— scopev2isn't in the documented scope list (roles/playbooks/modules/ci/deps); Tier-1 title validation may warn. configure_vddk_credentials.yml:26-30—vddk.image | split('/') | firstyields the image name, not a registry host, whenimagelacks a registry prefix.rfc1123name derivation: the filter (plugins/filter/rfc1123.py) replaces invalid chars, strips, dedupes, lowercases, truncates to 63 — invalid names and most collisions are impossible; only two distinct names sharing a 63-char prefix would collide. Residual risk low.- ~40 lines of repeated
credentials:/organization:across fivecontroller_job_launchblocks — consider factoring into a shared var. roles/e2e_testing/tests/inventoryhas no test playbook;files/.keep/templates/.keepare scaffolding noise.
Summary
BLOCK: 2 · HIGH: 2 · MEDIUM: 3 · NOTE: 8 · Files reviewed: 16
The draft is well-structured and follows collection conventions (docsible README, argument specs, vars/defaults split). The two BLOCKs are small fixes; the HIGH coaching items (destructive-tail guardrail, password-in-hostvars) are what will matter most for a fork-contributed PR that drives real migrations.
Hi @vvaldez . Thanks for the feedback
Let me know if theres anything blocking where we wouldnt be able to merge in this integration as the first step towards e2e coverage |
|
@sabre1041 Ran this PR through a live staged E2E on a real environment (OCP 4.21 + vSphere 8.0.2 + AAP 2.6 on-cluster, 9 runs through the flow). Answering your question first: nothing blocking merge. The live run validated the flow end to end; findings below. What the live run validated (final form)
The migration itself failed in guest conversion — environment + upstream, not this PR:
Findings from the live run (extends the earlier review)[CHANGE] verify_ready passes vacuously when the plan query returns no results. [CHANGE, minor] rescue path crashes on facts set later in the validate flow. When an early validate check fails in [CONFIRMED LIVE] scheme'd [NOTE] lifecycle gaps worth documenting:
The two CHANGEs are small fixes in this PR. The argument_spec item you flagged affects multiple roles as you said — agree that one is an issue, not this PR. |
Signed-off-by: Andrew Block <andy.block@gmail.com>
9bcdbd0 to
6a19227
Compare
@vvaldez Corrected the issues associated with verifying plans along with the credentials for the VDDK image. If everything looks satisfactory, please go ahead and merge |
vvaldez
left a comment
There was a problem hiding this comment.
Delta re-review (827d425 -> 6a19227) — dual pass (secops + devops, independent). Both response fixes verified sound:
verify_ready/verify_archivedempty-results guard: the old expression evaluated0 == 0-> true with zero plans, declaring them ready/archived vacuously; the newlength > 0 and (...)closes it. Real bug fix.- Token extraction in
utility_openshift_target_credential: wait +set_factalways run, display stays opt-in,no_logon the fact. Correct. - VDDK registry-hostname assert: the
whenchain guarantees non-empty image/username/password before the assert evaluates, and thefail_msgechoes only the image reference, not the credentials from the same dict. Right call.
Approving. Two follow-ups for a future pass, neither blocking:
- The auto-generated cluster-admin token (SA + secret from the api-key generation path) has no TTL and no revocation path. Consider TokenRequest
expirationSeconds, a least-privilege cluster role for the e2e path, or a teardown task before next release. - The
install_aapgate silently no-ops the whole flow for inventories that predate the variable (migration_aapends empty, every downstream play skips). Consider a guard after the add_host play when the group is empty, plus a changelog fragment for the user-facing changes.
Description
Base testing framework.
The following activities will be currently performed and driven by a playbook named
vmf_e2e_testing.ymlin theplaybooksdirectoryusername/passwordfields are provided alongside the VDDK image associated with the VMware environmentWhat is not currently covered:
Prerequisites
The following should be provided beforehand
How to Test
This models itself off of the existing inventory that is provided in this project. There is a larger vision for the ways that e2e can/will be used. However, for the purpose of this PR, the following can be utilized
migration_aaphost group. Add in any variables that you need to add. Thehostscan be left blank as it will dynamically be added at runtimevm_sourcesgroup and add in the applicable VMware environment detailsmigration_clustershost group with the followingvm_sourcesproperty and populate it with the hosts defined in thevm_sourcesgroupaap_hosts. The value should be the name of the OpenShift host cluster prefixed withaap_. If the OpenShift cluster is calledmigration_clusteras the host, the value in this field should beaap_migration_clustere2e_testing_openshift_plans_requestto represent the Plans request that will be made by the framework. The majority of the values are defaulted, so all you need to do is add the VM's that are desired to be migrated. Here is an exampleInvoke the
vmf_e2e_testing.ymland try it out!Type of Change