test.yml #1

  • //
  • guest/
  • russell_jackson/
  • ansible-sdp/
  • roles/
  • perforce-sdp-install/
  • tasks/
  • test.yml
  • View
  • Commits
  • Open Download .zip Download (1 KB)
---
# Run the SDP functional test harness on the target and surface its results.
# The harness ships with the SDP at /p4/sdp/test/sdp_test_harness.sh; it must run
# as the SDP OS user from a directory that user can read (hence chdir to /p4).
- name: "Confirm the SDP test harness is present"
  ansible.builtin.stat:
    path: "/p4/sdp/test/sdp_test_harness.sh"
  register: sdp_harness

- name: "Fail if the harness is missing (SDP predates it; reinstall to deploy)"
  ansible.builtin.fail:
    msg: "/p4/sdp/test/sdp_test_harness.sh not found. Re-run install to deploy the current SDP."
  when: not sdp_harness.stat.exists

- name: "Run the SDP functional test harness"
  become: true
  become_user: "{{ perforce_user }}"
  ansible.builtin.command:
    cmd: "/p4/sdp/test/sdp_test_harness.sh {{ perforce_id }}"
    chdir: "/p4"
  register: sdp_test_result
  changed_when: false
  failed_when: false

- name: "SDP test harness results"
  ansible.builtin.debug:
    var: sdp_test_result.stdout_lines

- name: "Report overall pass/fail"
  ansible.builtin.assert:
    that: "sdp_test_result.rc == 0"
    success_msg: "All SDP tests passed."
    fail_msg: "SDP test harness reported failures (rc={{ sdp_test_result.rc }}); see output above."
# Change User Description Committed
#1 32870 Russell C. Jackson (Rusty) ansible-sdp: add test.sh harness runner + manage_etc_hosts for test hosts

test.sh / tasks/test.yml / main-playbook (run_sdp_tests flag): run the SDP
functional test harness (/p4/sdp/test/sdp_test_harness.sh) on a target via
ansible and report pass/fail, matching the ping/install/monitor helper pattern.

manage_etc_hosts (default false; true in p4-cache-test host_vars): map the SDP
server DNS names (perforce_dnsname/standby = P4MASTERPORT) to this host in
/etc/hosts so master-targeting scripts (rotate_journal, daily_checkpoint,
p4login_master) resolve on test boxes that lack real DNS.