Skip to content

Commit

Permalink
Add molecule test for disconnected registry
Browse files Browse the repository at this point in the history
This change adds a molecule test for the disconnected registry
handling in edpm_podman

Signed-off-by: Brendan Shephard <[email protected]>
  • Loading branch information
bshephar committed Nov 14, 2024
1 parent f7f124d commit c03f40f
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
56 changes: 56 additions & 0 deletions roles/edpm_podman/molecule/disconnected/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# 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
hosts: all
tasks:
- name: Run install
include_role:
name: osp.edpm.edpm_podman
tasks_from: install.yml
vars_from: "redhat.yml"
vars:
edpm_podman_disconnected_ocp: true
edpm_podman_registries_conf: |
unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]
short-name-mode = ""
[[registry]]
prefix = ""
location = "quay.io/okd/scos-content"
[[registry.mirror]]
location = "quay.io/molecule/okd"
pull-from-mirror = "digest-only"
[[registry]]
prefix = ""
location = "quay.io/okd/scos-release"
# https://bugs.launchpad.net/bugs/1889510
- name: Test podman network ls
become: true
command: podman network ls

- name: Assert registries.conf matches
ansible.builtin.lineinfile:
name: /etc/containers/registries.conf
line: 'location = "quay.io/okd/scos-content"'
state: present
check_mode: true
register: registries
failed_when: registries is changed
28 changes: 28 additions & 0 deletions roles/edpm_podman/molecule/disconnected/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
provisioner:
name: ansible
config_options:
defaults:
fact_caching: jsonfile
fact_caching_connection: /tmp/molecule/facts
inventory:
hosts:
all:
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:
test_sequence:
- prepare
- converge
- check

verifier:
name: testinfra
30 changes: 30 additions & 0 deletions roles/edpm_podman/molecule/disconnected/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# 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 test_deps
hosts: all
gather_facts: false
roles:
- role: ../../../../molecule/common/test_deps
test_deps_extra_packages:
- runc
- containernetworking-plugins

- name: Prepare
hosts: all
become: true
gather_facts: false
roles:
- role: osp.edpm.env_data

0 comments on commit c03f40f

Please sign in to comment.