Skip to content

Commit e3ad716

Browse files
committed
Copied Tests from remote_pct
1 parent a699391 commit e3ad716

File tree

8 files changed

+735
-0
lines changed

8 files changed

+735
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
2+
# Copyright (c) 2025 Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
azp/posix/3
7+
destructive
8+
needs/root
9+
needs/target/connection
10+
skip/docker
11+
skip/alpine
12+
skip/macos
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
3+
# Copyright (c) 2025 Ansible Project
4+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
- hosts: localhost
8+
gather_facts: true
9+
serial: 1
10+
tasks:
11+
- name: Copy qm mock
12+
copy:
13+
src: files/qm
14+
dest: /usr/sbin/qm
15+
mode: '0755'
16+
- name: Install paramiko
17+
pip:
18+
name: "paramiko>=3.0.0"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
3+
# Copyright (c) 2025 Ansible Project
4+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
# Shell script to mock proxmox qm behaviour
8+
9+
>&2 echo "[DEBUG] INPUT: $@"
10+
11+
pwd="$(pwd)"
12+
13+
# Get quoted parts and restore quotes
14+
declare -a cmd=()
15+
for arg in "$@"; do
16+
if [[ $arg =~ [[:space:]] ]]; then
17+
arg="'$arg'"
18+
fi
19+
cmd+=("$arg")
20+
done
21+
22+
cmd="${cmd[@]:3}"
23+
vmid="${@:2:1}"
24+
>&2 echo "[INFO] MOCKING: qm ${@:1:3} ${cmd}"
25+
tmp_dir="/tmp/ansible-remote/proxmox_qm_remote/integration_test/vm_${vmid}"
26+
mkdir -p "$tmp_dir"
27+
>&2 echo "[INFO] PWD: $tmp_dir"
28+
>&2 echo "[INFO] CMD: ${cmd}"
29+
cd "$tmp_dir"
30+
31+
eval "${cmd}"
32+
33+
cd "$pwd"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
- hosts: "{{ target_hosts }}"
7+
gather_facts: false
8+
serial: 1
9+
tasks:
10+
- name: create file without content
11+
copy:
12+
content: ""
13+
dest: "{{ remote_tmp }}/test_empty.txt"
14+
force: no
15+
mode: '0644'
16+
17+
- name: assert file without content exists
18+
stat:
19+
path: "{{ remote_tmp }}/test_empty.txt"
20+
register: empty_file_stat
21+
22+
- name: verify file without content exists
23+
assert:
24+
that:
25+
- empty_file_stat.stat.exists
26+
fail_msg: "The file {{ remote_tmp }}/test_empty.txt does not exist."
27+
28+
- name: verify file without content is empty
29+
assert:
30+
that:
31+
- empty_file_stat.stat.size == 0
32+
fail_msg: "The file {{ remote_tmp }}/test_empty.txt is not empty."
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
3+
# Copyright (c) 2025 Ansible Project
4+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
set -eux
8+
9+
ANSIBLE_ROLES_PATH=../ \
10+
ansible-playbook dependencies.yml -v "$@"
11+
12+
./test.sh "$@"
13+
14+
ansible-playbook plugin-specific-tests.yml -i "./test_connection.inventory" \
15+
-e target_hosts="proxmox_qm_remote" \
16+
-e action_prefix= \
17+
-e local_tmp=/tmp/ansible-local \
18+
-e remote_tmp=/tmp/ansible-remote \
19+
"$@"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../connection_posix/test.sh
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
2+
# Copyright (c) 2025 Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
[proxmox_qm_remote]
7+
proxmox_qm_remote-pipelining ansible_ssh_pipelining=true
8+
proxmox_qm_remote-no-pipelining ansible_ssh_pipelining=false
9+
[proxmox_qm_remote:vars]
10+
ansible_host=localhost
11+
ansible_user=root
12+
ansible_python_interpreter="{{ ansible_playbook_python }}"
13+
ansible_connection=community.proxmox.proxmox_qm_remote
14+
proxmox_vmid=123

0 commit comments

Comments
 (0)