This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Molecule QEMU tests

Ansible-native lifecycle for disposable Fedora smoke guests

    //tools/molecule:smoke_test boots the pinned Fedora 44 cloud image in a local QEMU guest. The test uses //tools/ansible:molecule and native create, prepare, converge, idempotence, verify, and destroy actions. It verifies SSH connectivity, the Fedora version, and a file written by Ansible.

    Molecule QEMU test flowMolecule QEMU test flow

    Diagram source

    The smoke target requires Linux x86-64 with QEMU and OpenSSH. Bazel builds the read-only cloud-init seed ISO from fixed metadata and the Molecule CA public snapshot using the shared ISO image rule. The ISO build is offline. At test time, the AL wrapper uses the Molecule test AppRole to generate a fresh keypair and obtain a signed fedora certificate from Vault. The wrapper deletes its key material when the invocation ends.

    bazel build //tools/molecule:seed_iso
    bazel test --test_env=HOME //tools/molecule:smoke_test //tools/molecule:failure_test \
      //tools/molecule:cancellation_test
    

    The test launcher uses HOME to find the Vault token helper. Molecule and Ansible run with a separate test home and the temporary SSH credential.

    The additional modes exercise an assertion failure and interruption during verification. Molecule runs its teardown after the assertion fails. An interrupt can exit before teardown, so the cancellation test invokes the same molecule destroy action with a bounded timeout. Use Bazel’s local test sandbox for process isolation when aborting the whole Bazel invocation.

    The test allocates an SSH port bound to loopback and uses temporary keys, an isolated inventory, and a fresh overlay. The Molecule phase log is available in the Bazel test outputs.