Merge "bnr added cli-undercloud-backup-db molecule job"

This commit is contained in:
Zuul 2022-05-20 02:45:44 +00:00 committed by Gerrit Code Review
commit 8f341d5f1e
4 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,22 @@
---
# 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.
- name: Converge
become: true
hosts: all
- import_playbook: ../../../../playbooks/cli-undercloud-db-backup.yaml

View File

@ -0,0 +1,37 @@
---
provisioner:
name: ansible
options:
'extra-vars': 'tripleo_backup_and_restore_hide_sensitive_logs=false tripleo_backup_and_restore_hiera_config_file={{ ansible_user_dir }}/hiera.yaml'
config_options:
defaults:
fact_caching: jsonfile
fact_caching_connection: /tmp/molecule/facts
inventory:
hosts:
all:
hosts:
instance:
ansible_host: localhost
Undercloud:
hosts:
instance:
ansible_host: localhost
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
ANSIBLE_LIBRARY: "${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}"
ANSIBLE_FILTER_PLUGINS: "${ANSIBLE_FILTER_PLUGINS:-/usr/share/ansible/plugins/filter}"
scenario:
name: cli_undercloud_backup_db
test_sequence:
- destroy
- create
- prepare
- converge
- destroy
verifier:
name: testinfra

View File

@ -0,0 +1,114 @@
---
# 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.
- name: Prepare
hosts: all
become: true
gather_facts: true
pre_tasks:
- name: set basic user fact
set_fact:
ansible_user: "{{ lookup('env', 'USER') }}"
when:
- ansible_user is undefined
- name: set basic home fact
set_fact:
ansible_user_dir: "{{ lookup('env', 'HOME') }}"
when:
- ansible_user_dir is undefined
- name: Disable SELinux
selinux:
state: disabled
roles:
- role: test_deps
test_deps_setup_tripleo: true
test_deps_tripleo_packages:
- hiera
- podman
test_deps_extra_packages:
- rear
- syslinux
- genisoimage
- kbd
post_tasks:
- name: Create hiera config file
file:
path: "{{ ansible_user_dir }}/hiera.yaml"
state: touch
- name: Create hieradata directory
file:
path: "{{ ansible_user_dir }}/hieradata"
state: directory
mode: '0755'
- name: Insert some data into hiera.yaml
copy:
dest: "{{ ansible_user_dir }}/hiera.yaml"
content: |
---
:backends:
- json
:json:
:datadir: {{ ansible_user_dir }}/hieradata
:hierarchy:
- service_configs
- name: Insert some data into service_configs.json
copy:
dest: "{{ ansible_user_dir }}/hieradata/service_configs.json"
content: |
{
"mysql::server::root_password": "password"
}
- name: pull some images
containers.podman.podman_image:
name: "{{ item }}"
with_items:
- registry.access.redhat.com/ubi8/ubi-minimal
- mysql
- name: Create a data container
containers.podman.podman_container:
name: "{{ item }}"
image: ubi-minimal
state: started
command: sleep 1d
with_items:
- test-container1
- test-container2
- name: Start myql container
containers.podman.podman_container:
name: mysql
image: mysql
state: started
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_PORT: 3306
- name: Wait until mysql is up
shell: podman exec mysql bash -c "find /run/mysqld/mysqld.sock -type s"
register: mysql_result
until: mysql_result.rc == 0
retries: 20
delay: 5

View File

@ -1,6 +1,8 @@
---
provisioner:
name: ansible
options:
'extra-vars': 'tripleo_backup_and_restore_hide_sensitive_logs=false tripleo_backup_and_restore_hiera_config_file="{{ ansible_user_dir }}/hiera.yaml"'
config_options:
defaults:
fact_caching: jsonfile
@ -21,8 +23,12 @@ provisioner:
scenario:
name: default
test_sequence:
- destroy
- create
- prepare
- converge
- destroy
verifier:
name: testinfra