mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
adds tests
This commit is contained in:
7
tests/integration/targets/android_sdk/meta/main.yml
Normal file
7
tests/integration/targets/android_sdk/meta/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# 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
|
||||
|
||||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
69
tests/integration/targets/android_sdk/tasks/main.yml
Normal file
69
tests/integration/targets/android_sdk/tasks/main.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
- import_tasks: setup.yml
|
||||
|
||||
- name: Setup environment
|
||||
environment:
|
||||
PATH: '{{ ansible_env.PATH }}:{{ android_sdk_location }}/cmdline-tools/latest/bin'
|
||||
ANDROID_HOME: "{{ android_sdk_location }}"
|
||||
block:
|
||||
|
||||
- name: Accept all licenses
|
||||
shell: 'yes | sdkmanager --licenses'
|
||||
changed_when: false
|
||||
|
||||
- name: Install build-tools;34.0.0
|
||||
android_sdk:
|
||||
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
|
||||
state: present
|
||||
register: platform_tools_present
|
||||
|
||||
- name: Install (update) platform-tools
|
||||
android_sdk:
|
||||
name: platform-tools
|
||||
state: latest
|
||||
register: platform_tools_updated
|
||||
|
||||
- name: Run tests
|
||||
assert:
|
||||
that:
|
||||
- build_tools_34_0_0.stat.exists
|
||||
- build_tools_installed.changed
|
||||
- not build_tools_installed2.changed
|
||||
- build_tools_deleted.changed
|
||||
- not build_tools_deleted2.changed
|
||||
- not platform_tools_present.changed
|
||||
- platform_tools_updated.changed
|
||||
@@ -7,23 +7,25 @@
|
||||
become: true
|
||||
package:
|
||||
name:
|
||||
- java-21-openjdk
|
||||
# - java-21-openjdk-headless
|
||||
- openjdk-17-jdk-headless
|
||||
- unzip
|
||||
state: present
|
||||
|
||||
- name: Print env
|
||||
debug:
|
||||
var: ansible_env
|
||||
|
||||
- name: Create Android SDK directory
|
||||
become: true
|
||||
file:
|
||||
path: "{{ android_sdk_location }}"
|
||||
state: directory
|
||||
owner: vagrant
|
||||
group: vagrant
|
||||
|
||||
- name: Check that sdkmanager is installed
|
||||
stat:
|
||||
path: "{{ android_sdk_location }}/cmdline-tools/latest/bin/sdkmanager"
|
||||
register: sdkmanager_installed
|
||||
|
||||
|
||||
- name: Install Android command line tools
|
||||
when: not sdkmanager_installed.stat.exists
|
||||
block:
|
||||
@@ -49,4 +51,3 @@
|
||||
src: "{{ android_cmdline_temp_dir }}/cmdline-tools/"
|
||||
dest: "{{ android_sdk_location }}/cmdline-tools/latest"
|
||||
remote_src: yes
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
android_cmdline_temp_dir: "/tmp/cmdlinetools"
|
||||
android_sdk_location: /usr/local/android/sdk
|
||||
android_sdk_location: "/tmp/androidsdk"
|
||||
commandline_tools_link: https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
|
||||
Reference in New Issue
Block a user