community.general/tests/integration/targets/android_sdk/tasks/default-tests.yml
Stanislav Shamilov 2b2872f0ef
Add android sdk module (#9236)
* adds simple implementation of adding and removing android sdk packages

* adds package update

* adds simple installed packages parsing

* moves parsing logic to a separate class

* adds absent state for sdkmanager packages and setup for tests

* adds output for installing and removing packages

* removes version from Package object since it is not possible to specify version for a package while using sdkmanager

* adds 'latest' state

* adds tests

* fixes crash when sdkmanager is invoked from python with LC_ALL=C

* fixes latest state

* adds sdk_root parameter

* adds channel parameter

* simplifies regexps, removes unused named groups

* minor refactoring of sdkmanager parsing

* adds java dependency variable for different distributions

* adds RETURN documentation

* adds check for nonexisting package

* adds check for non-accepted licenses

* removes excessive methods from sdkmanager

* removes unused 'update' module parameter, packages may be updated using 'latest' state

* minor refactoring

* adds EXAMPLES doc section

* adds DOCUMENTATION section and license headers

* fixes formatting issues

* removes diff_params

* adds maintainer

* fixes sanity check issues in sdkmanager

* adds java dependency for macos and moves some tests to a separate FreeBSD configuration

* fixes dependencies setup for OSX

* fixes dependencies setup for OSX (2)

* fixes dependencies setup for OSX (3)

* Apply minor suggestions from code review

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

* applies code review suggestions

* changes force_lang from C.UTF-8 to auto in sdkmanager (as per discussion https://github.com/ansible-collections/community.general/pull/9236#discussion_r1881114326)

* Revert "changes force_lang from C.UTF-8 to auto in sdkmanager (as per discussion https://github.com/ansible-collections/community.general/pull/9236#discussion_r1881114326)"

This reverts commit 619f28dd58.

* fixes some more comments from review

* minor sanity issue fix

* uses the 'changed' test instead of checking the 'changed' attribute

* adds 'accept_licenses' parameter. Installation is now performed independently for each package specified.

* removes "Accept licenses" task from examples

* fixes docs sanity issues

* applies minor suggestions from code review

* fixes regexps. The previous version didn't match versions like "32.1.0 rc1". Also, this allows to simplify the parsing logic as there is no need to skip table headers anymore.

* renamed sdkmanager.py to android_sdkmanager.py

* applies minor suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* updates BOTMETA

* reordered BOTMETA

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2024-12-20 22:55:12 +01:00

92 lines
No EOL
2.5 KiB
YAML

---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Install build-tools;34.0.0
android_sdk:
accept_licenses: true
name: build-tools;34.0.0
state: present
register: build_tools_installed
- name: Install build-tools;34.0.0 second time
android_sdk:
name: build-tools;34.0.0
state: present
register: build_tools_installed2
- name: Stat build-tools
stat:
path: "{{ android_sdk_location }}/build-tools/34.0.0"
register: build_tools_34_0_0
- name: Delete build-tools;34.0.0
android_sdk:
name: build-tools;34.0.0
state: absent
register: build_tools_deleted
- name: Delete build-tools;34.0.0 second time
android_sdk:
name: build-tools;34.0.0
state: absent
register: build_tools_deleted2
- name: Download old platform-tools
unarchive:
src: https://dl.google.com/android/repository/platform-tools_r27.0.0-linux.zip
remote_src: true
dest: "{{ android_sdk_location }}"
- name: Try installing platform-tools from sdkmanager
android_sdk:
name: platform-tools
accept_licenses: true
state: present
register: platform_tools_present
- name: Install (update) platform-tools
android_sdk:
name: platform-tools
state: latest
register: platform_tools_updated
- name: Install a package to a new root
android_sdk:
name: build-tools;34.0.0
accept_licenses: true
state: present
sdk_root: "{{ remote_tmp_dir }}"
register: new_root_package
- name: Check package is installed
stat:
path: "{{ remote_tmp_dir }}/build-tools/34.0.0"
register: new_root_package_stat
- name: Install a package from canary channel
android_sdk:
name: build-tools;33.0.0
state: present
channel: canary
register: package_canary
- name: Run tests
assert:
that:
- build_tools_34_0_0.stat.exists
- build_tools_installed is changed
- build_tools_installed2 is not changed
- build_tools_deleted is changed
- build_tools_deleted2 is not changed
- platform_tools_present is not changed
- platform_tools_updated is changed
- new_root_package is changed
- new_root_package_stat.stat.exists
- package_canary is changed