test(cloudflared): add the default molecule scenario
Runs without Cloudflare and without a real cloudflared: a stub of the Cloudflare API on the controller's loopback answers the tunnel, zone and DNS record calls through cloudflared_api_base_url, a stub binary stands in for the daemon, and the releases come from file:// URLs. Covers the converge with an update through _binary_update and its idempotence, the rendered files and the running unit, the input asserts, the deleted-tunnel and DNS guards, a stale hash and a failed checksum, the mint entry point (as child processes outside CI) and the remove path. The cloudflare_dns calls cannot reach the stub and are not run. Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
1 parent
e308683431
commit
9a626962a5
8 files changed
+831
No files matched your search
@@ -0,0 +1,23 @@
|
||||
---
|
||||
# Stops the Cloudflare API stub that prepare.yml started on the controller. Also run before
|
||||
# create, when there is nothing to stop yet.
|
||||
- name: Cleanup
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
vars:
|
||||
cloudflared_test_stub_dir: "{{ lookup('ansible.builtin.env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/cloudflare-stub"
|
||||
tasks:
|
||||
- name: Read the pid of the stub
|
||||
ansible.builtin.slurp:
|
||||
src: "{{ cloudflared_test_stub_dir }}/pid"
|
||||
register: cloudflared_test_stub_pid
|
||||
failed_when: false
|
||||
|
||||
- name: Stop the stub
|
||||
ansible.builtin.command:
|
||||
argv: [kill, "{{ cloudflared_test_stub_pid.content | b64decode | trim }}"]
|
||||
# It may have ended at its lifetime already.
|
||||
failed_when: false
|
||||
changed_when: true
|
||||
when: cloudflared_test_stub_pid.content is defined
|
||||
Reference in new issue
Block a user