Merge "Create role for molecule prep"
This commit is contained in:
44
roles/test_molecule_prep/README.md
Normal file
44
roles/test_molecule_prep/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
test_molecule_prep
|
||||
==================
|
||||
|
||||
A role to do collection install for molecule testing. The role assumes it's being
|
||||
run from a molecule path.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `test_module_prep_collections_build_root`: (String) Path a directory to output the collection build to. Default: "{{ ansible_env.HOME }}/collection-buildroot"
|
||||
* `test_module_prep_execution_root`: (String) Path to the directory where the build action should run in. Default: '../../../..'
|
||||
|
||||
Output Variables
|
||||
----------------
|
||||
|
||||
None.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example install execution playbook
|
||||
|
||||
```yaml
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Do molecule prep actions
|
||||
import_role:
|
||||
name: test_molecule_prep
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
||||
4
roles/test_molecule_prep/defaults/main.yml
Normal file
4
roles/test_molecule_prep/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
# defaults file for test_molecule_prep
|
||||
test_molecule_prep_collections_build_root: "{{ ansible_env.HOME }}/collection-buildroot"
|
||||
test_molecule_prep_execution_root: "../../../.."
|
||||
42
roles/test_molecule_prep/meta/main.yml
Normal file
42
roles/test_molecule_prep/meta/main.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
galaxy_info:
|
||||
author: OpenStack
|
||||
description: TripleO Operator Role -- test_molecule_prep
|
||||
company: Red Hat
|
||||
license: Apache-2.0
|
||||
min_ansible_version: 2.8
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
platforms:
|
||||
- name: CentOS
|
||||
versions:
|
||||
- 7
|
||||
- 8
|
||||
|
||||
galaxy_tags:
|
||||
- tripleo
|
||||
|
||||
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
dependencies: []
|
||||
21
roles/test_molecule_prep/molecule/default/molecule.yml
Normal file
21
roles/test_molecule_prep/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
driver:
|
||||
name: delegated
|
||||
options:
|
||||
managed: false
|
||||
ansible_connection_options:
|
||||
ansible_connection: local
|
||||
log: true
|
||||
lint:
|
||||
name: yamllint
|
||||
enabled: false
|
||||
platforms:
|
||||
- name: instance
|
||||
provisioner:
|
||||
name: ansible
|
||||
scenario:
|
||||
name: default
|
||||
test_sequence:
|
||||
- syntax
|
||||
- converge
|
||||
- verify
|
||||
17
roles/test_molecule_prep/molecule/default/playbook.yml
Normal file
17
roles/test_molecule_prep/molecule/default/playbook.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
tasks:
|
||||
|
||||
- name: "Include test_molecule_prep"
|
||||
include_role:
|
||||
name: "test_molecule_prep"
|
||||
|
||||
- name: Test known collection filter
|
||||
set_fact:
|
||||
test_var: "{{ 'test' | tripleo.operator.shell_arg_list(parameter='--test') }}"
|
||||
|
||||
- name: Assert value
|
||||
assert:
|
||||
that:
|
||||
- test_var == "--test test"
|
||||
12
roles/test_molecule_prep/tasks/main.yml
Normal file
12
roles/test_molecule_prep/tasks/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Build collection
|
||||
shell: >-
|
||||
pwd && ansible-galaxy collection build --force --output-path {{ test_molecule_prep_collections_build_root }}
|
||||
args:
|
||||
chdir: "{{ test_molecule_prep_execution_root }}"
|
||||
changed_when: true
|
||||
|
||||
- name: Install collection
|
||||
shell: >-
|
||||
ansible-galaxy collection install --force {{ test_molecule_prep_collections_build_root }}/tripleo-operator*
|
||||
changed_when: true
|
||||
1
roles/test_molecule_prep/tests/inventory
Normal file
1
roles/test_molecule_prep/tests/inventory
Normal file
@@ -0,0 +1 @@
|
||||
localhost
|
||||
4
roles/test_molecule_prep/tests/test.yml
Normal file
4
roles/test_molecule_prep/tests/test.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- test_molecule_prep
|
||||
@@ -2,6 +2,7 @@
|
||||
name: tripleo-operator-molecule-jobs
|
||||
check:
|
||||
jobs:
|
||||
- tripleo-operator-molecule-test_molecule_prep
|
||||
- tripleo-operator-molecule-tripleo_container_image_delete
|
||||
- tripleo-operator-molecule-tripleo_container_image_list
|
||||
- tripleo-operator-molecule-tripleo_container_image_push
|
||||
@@ -14,6 +15,7 @@
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
- tripleo-operator-molecule-test_molecule_prep
|
||||
- tripleo-operator-molecule-tripleo_container_image_delete
|
||||
- tripleo-operator-molecule-tripleo_container_image_list
|
||||
- tripleo-operator-molecule-tripleo_container_image_push
|
||||
@@ -24,6 +26,15 @@
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_configure
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_clean
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/test_molecule_prep/.*
|
||||
- ^plugins/.*
|
||||
name: tripleo-operator-molecule-test_molecule_prep
|
||||
parent: tripleo-operator-molecule-base
|
||||
vars:
|
||||
tox_extra_args: test_molecule_prep
|
||||
|
||||
- job:
|
||||
name: tripleo-operator-molecule-base
|
||||
abstract: true
|
||||
|
||||
Reference in New Issue
Block a user