Execute functional tests through molecule

This adopts old functional tests to be executed and verified through
molecule instead of the leveraging tests repo.

We do not yet fully test connection plugin as more work needs to
be put into it.

Change-Id: I8a42464f34f2438642046f28a4e8451fd876dcf1
This commit is contained in:
Dmitriy Rabotyagov
2025-03-18 19:01:48 +01:00
parent 3ad24ae893
commit f0239eafec
5 changed files with 17 additions and 33 deletions

View File

@@ -0,0 +1,7 @@
---
- name: Running filters tests
ansible.builtin.import_playbook: ../../tests/test-filters.yml
- name: Running modules tests
ansible.builtin.import_playbook: ../../tests/test-modules.yml

View File

@@ -22,7 +22,7 @@
- name: Validate string_2_int filter
ansible.builtin.assert:
that:
- "{{ 'test' | string_2_int }} == 3752"
- "{{ 'test' | openstack.osa.string_2_int }} == 3752"
- name: Set pip package list facts
ansible.builtin.set_fact:
@@ -53,7 +53,7 @@
- test
- name: Set splitlines filter fact
ansible.builtin.set_fact:
string_split_lines_filtered: "{{ string_with_lines | splitlines }}"
string_split_lines_filtered: "{{ string_with_lines | openstack.osa.splitlines }}"
- name: Validate splitlines filter
ansible.builtin.assert:
that: "string_split_lines_filtered == string_split_lines"
@@ -75,7 +75,7 @@
old_var: old
- name: Set deprecated filter fact
ansible.builtin.set_fact:
deprecated_value: "{{ new_var | deprecated(old_var, 'old_var', 'new_var', 'Next Release', false) }}"
deprecated_value: "{{ new_var | openstack.osa.deprecated(old_var, 'old_var', 'new_var', 'Next Release', false) }}"
- name: Validate deprecated filter
ansible.builtin.assert:
that: "deprecated_value == old_var"

View File

@@ -17,9 +17,11 @@
hosts: localhost
connection: local
gather_facts: false
vars_files:
- vars/provider_networks.yml
tasks:
- name: Test network mapping consistent order
provider_networks:
openstack.osa.provider_networks:
provider_networks: "{{ provider_networks }}"
bind_prefix: "{{ provider_network_bind_prefix | default('') }}"
is_metal: "{{ is_metal }}"
@@ -29,6 +31,5 @@
- name: Verify network mappings have a consistent order
ansible.builtin.assert:
that: >-
pndata.results | map(attribute='network_mappings') | unique | length
== 1
that:
- pndata.results | map(attribute='network_mappings') | unique | length == 1

View File

@@ -1,26 +0,0 @@
---
# Copyright 2016, @WalmartLabs
#
# 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: Collect facts for all hosts
hosts: hosts:!fake_hosts
gather_facts: yes
- import_playbook: common/test-setup-host.yml
- import_playbook: test-filters.yml
- import_playbook: test-strategy-tagfilter.yml
- import_playbook: test-connection-plugin.yml

View File

@@ -1,3 +1,5 @@
---
is_metal: true
provider_networks:
- network:
container_bridge: "br-mgmt"