mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
New module for cargo command (#3712)
* New module for cargo command * Resolve CI errors * Update plugins/modules/packaging/language/cargo.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/packaging/language/cargo.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/packaging/language/cargo.py Co-authored-by: Felix Fontein <felix@fontein.de> * Add maintainer * Change installed_packages from property to function * Allow cargo to install list of of packages * Remove period at the end of task names * Pass only the list of packages to take action on to cargo * Add integration tests for cargo * Update plugins/modules/packaging/language/cargo.py Co-authored-by: Felix Fontein <felix@fontein.de> * Apply suggestions from code review * Update tests/integration/targets/cargo/tasks/setup.yml * Update tests/integration/targets/cargo/tasks/setup.yml Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
77a930cf6b
commit
7c21a27c5d
8 changed files with 286 additions and 0 deletions
3
tests/integration/targets/cargo/aliases
Normal file
3
tests/integration/targets/cargo/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
destructive
|
||||
shippable/posix/group2
|
||||
skip/aix
|
5
tests/integration/targets/cargo/tasks/main.yml
Normal file
5
tests/integration/targets/cargo/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- import_tasks: setup.yml
|
||||
- block:
|
||||
- import_tasks: test_general.yml
|
||||
- import_tasks: test_version.yml
|
||||
when: has_cargo | default(false)
|
14
tests/integration/targets/cargo/tasks/setup.yml
Normal file
14
tests/integration/targets/cargo/tasks/setup.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- block:
|
||||
- name: Install cargo
|
||||
package:
|
||||
name: cargo
|
||||
state: present
|
||||
- set_fact:
|
||||
has_cargo: true
|
||||
when:
|
||||
- ansible_system != 'FreeBSD' or ansible_distribution_version is version('13.0', '>')
|
||||
- ansible_distribution != 'MacOSX'
|
||||
- ansible_distribution != 'RedHat' or ansible_distribution_version is version('8.0', '>=')
|
||||
- ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=')
|
||||
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=')
|
31
tests/integration/targets/cargo/tasks/test_general.yml
Normal file
31
tests/integration/targets/cargo/tasks/test_general.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- name: Ensure application helloworld is uninstalled
|
||||
community.general.cargo:
|
||||
state: absent
|
||||
name: helloworld
|
||||
register: uninstall_absent_helloworld
|
||||
|
||||
- name: Install application helloworld
|
||||
community.general.cargo:
|
||||
name: helloworld
|
||||
register: install_absent_helloworld
|
||||
|
||||
- name: Install application helloworld again
|
||||
community.general.cargo:
|
||||
name: helloworld
|
||||
register: install_present_helloworld
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Uninstall application helloworld
|
||||
community.general.cargo:
|
||||
state: absent
|
||||
name: helloworld
|
||||
register: uninstall_present_helloworld
|
||||
|
||||
- name: Check assertions helloworld
|
||||
assert:
|
||||
that:
|
||||
- uninstall_absent_helloworld is not changed
|
||||
- install_absent_helloworld is changed
|
||||
- install_present_helloworld is not changed
|
||||
- uninstall_present_helloworld is changed
|
25
tests/integration/targets/cargo/tasks/test_version.yml
Normal file
25
tests/integration/targets/cargo/tasks/test_version.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
- name: Install application helloworld-yliu 0.1.0
|
||||
community.general.cargo:
|
||||
name: helloworld-yliu
|
||||
version: 0.1.0
|
||||
register: install_helloworld_010
|
||||
|
||||
- name: Upgrade helloworld-yliu 0.1.0
|
||||
community.general.cargo:
|
||||
name: helloworld-yliu
|
||||
state: latest
|
||||
register: upgrade_helloworld_010
|
||||
|
||||
- name: Downgrade helloworld-yliu 0.1.0
|
||||
community.general.cargo:
|
||||
name: helloworld-yliu
|
||||
version: 0.1.0
|
||||
register: downgrade_helloworld_010
|
||||
|
||||
- name: Check assertions helloworld-yliu 0.1.0
|
||||
assert:
|
||||
that:
|
||||
- install_helloworld_010 is changed
|
||||
- upgrade_helloworld_010 is changed
|
||||
- downgrade_helloworld_010 is changed
|
Loading…
Add table
Add a link
Reference in a new issue