diff --git a/.gitignore b/.gitignore index 550d3473..53434a58 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,10 @@ src/molecule_plugins/_version.py # Ignore generated files test/roles + +# Quilt/Patch generated files +.pc +patches +*.patch +*.orig +*.rej diff --git a/molecule/test-podman/molecule.yml b/molecule/test-podman/molecule.yml index 73a3003a..930292fe 100644 --- a/molecule/test-podman/molecule.yml +++ b/molecule/test-podman/molecule.yml @@ -5,7 +5,7 @@ driver: name: podman platforms: - name: instance - image: docker.io/pycontribs/centos:8 + image: quay.io/centos/centos:stream9 pre_build_image: true published_ports: - 127.0.0.1:2080:80 diff --git a/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml b/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml index 9b4cf081..350ea169 100644 --- a/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml +++ b/src/molecule_plugins/docker/playbooks/validate-dockerfile.yml @@ -9,7 +9,7 @@ # platforms supported as being managed by molecule/ansible, this does # not mean molecule itself can run on them. - image: alpine:edge - - image: quay.io/centos/centos:stream8 + - image: quay.io/centos/centos:stream9 - image: ubuntu:latest - image: debian:latest tags: diff --git a/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml b/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml index 98e0b249..7238992c 100644 --- a/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml +++ b/src/molecule_plugins/podman/playbooks/validate-dockerfile.yml @@ -9,14 +9,13 @@ # platforms supported as being managed by molecule/ansible, this does # not mean molecule itself can run on them. - image: alpine:edge - - image: centos:7 - # - image: centos:8 + - image: quay.io/centos/centos:stream9 - image: ubuntu:latest - image: debian:latest tasks: - name: Create isolated build directories for each image ansible.builtin.tempfile: - prefix: "molecule-dockerfile-{{ item.image }}" + prefix: "molecule-dockerfile-{{ item.image | replace('/', '-') }}" state: directory register: temp_image_dirs with_items: "{{ platforms }}" diff --git a/test/azure/functional/test_azure.py b/test/azure/functional/test_azure.py index 94a64d23..ffe94689 100644 --- a/test/azure/functional/test_azure.py +++ b/test/azure/functional/test_azure.py @@ -76,6 +76,9 @@ def test_azure_command_init_scenario(temp_dir): assert os.path.isdir(scenario_directory) + os.unlink(os.path.join(scenario_directory, "create.yml")) + os.unlink(os.path.join(scenario_directory, "destroy.yml")) + # temporary trick to pass on CI/CD if "AZURE_SECRET" in os.environ: cmd = ["molecule", "test", "-s", "test-scenario"] diff --git a/test/docker/scenarios/env-substitution/molecule/default/molecule.yml b/test/docker/scenarios/env-substitution/molecule/default/molecule.yml index 378b1abe..e29d82ea 100644 --- a/test/docker/scenarios/env-substitution/molecule/default/molecule.yml +++ b/test/docker/scenarios/env-substitution/molecule/default/molecule.yml @@ -3,7 +3,7 @@ driver: name: docker platforms: - name: instance-${DOES_NOT_EXIST:-local} - image: ${MOLECULE_ROLE_IMAGE:-centos:7} + image: ${MOLECULE_ROLE_IMAGE:-quay.io/centos/centos:stream9} pre_build_image: false provisioner: name: ansible diff --git a/test/ec2/functional/test_ec2.py b/test/ec2/functional/test_ec2.py index 0ef21fc1..e546a442 100644 --- a/test/ec2/functional/test_ec2.py +++ b/test/ec2/functional/test_ec2.py @@ -51,6 +51,8 @@ def test_ec2_command_init_scenario(temp_dir): assert run_command(cmd).returncode == 0 assert os.path.isdir(scenario_directory) + os.unlink(os.path.join(scenario_directory, "create.yml")) + os.unlink(os.path.join(scenario_directory, "destroy.yml")) cmd = ["molecule", "test", "-s", "test-scenario"] assert run_command(cmd).returncode == 0 diff --git a/test/gce/functional/test_func.py b/test/gce/functional/test_func.py index cd1c5ea3..8fe05f15 100644 --- a/test/gce/functional/test_func.py +++ b/test/gce/functional/test_func.py @@ -55,6 +55,8 @@ def test_gce_command_init_scenario(temp_dir): assert run_command(cmd).returncode == 0 assert os.path.isdir(scenario_directory) + os.unlink(os.path.join(scenario_directory, "create.yml")) + os.unlink(os.path.join(scenario_directory, "destroy.yml")) cmd = ["molecule", "test", "-s", "test-scenario"] assert run_command(cmd).returncode == 0 diff --git a/test/openstack/test_func.py b/test/openstack/test_func.py index 2e3422a0..44e57c5b 100644 --- a/test/openstack/test_func.py +++ b/test/openstack/test_func.py @@ -57,6 +57,8 @@ def test_openstack_init_and_test_scenario(tmp_path: pathlib.Path, DRIVER: str) - assert result.returncode == 0 assert scenario_directory.exists() + os.unlink(os.path.join(scenario_directory, "create.yml")) + os.unlink(os.path.join(scenario_directory, "destroy.yml")) confpath = os.path.join(scenario_directory, "molecule.yml") testconf = os.path.join( diff --git a/test/vagrant/__init__.py b/test/vagrant-plugin/__init__.py similarity index 100% rename from test/vagrant/__init__.py rename to test/vagrant-plugin/__init__.py diff --git a/test/vagrant/functional/__init__.py b/test/vagrant-plugin/functional/__init__.py similarity index 100% rename from test/vagrant/functional/__init__.py rename to test/vagrant-plugin/functional/__init__.py diff --git a/test/vagrant/functional/conftest.py b/test/vagrant-plugin/functional/conftest.py similarity index 100% rename from test/vagrant/functional/conftest.py rename to test/vagrant-plugin/functional/conftest.py diff --git a/test/vagrant/functional/test_func.py b/test/vagrant-plugin/functional/test_func.py similarity index 95% rename from test/vagrant/functional/test_func.py rename to test/vagrant-plugin/functional/test_func.py index b0d48f53..9fedef4e 100644 --- a/test/vagrant/functional/test_func.py +++ b/test/vagrant-plugin/functional/test_func.py @@ -24,8 +24,8 @@ import shutil import pytest - import vagrant + from conftest import change_dir_to from molecule import logger, util from molecule.scenario import ephemeral_directory @@ -63,6 +63,11 @@ def test_vagrant_command_init_scenario(temp_dir): assert result.returncode == 0 assert os.path.isdir(scenario_directory) + + # Clean unwanted default create/destroy files from molecule init + os.unlink(os.path.join(scenario_directory, "create.yml")) + os.unlink(os.path.join(scenario_directory, "destroy.yml")) + confpath = os.path.join(scenario_directory, "molecule.yml") conf = util.safe_load_file(confpath) env = os.environ @@ -71,7 +76,6 @@ def test_vagrant_command_init_scenario(temp_dir): if "vagrant-libvirt" in [x.name for x in vagrant.Vagrant().plugin_list()]: conf["driver"]["provider"] = {"name": "libvirt"} util.write_file(confpath, util.safe_dump(conf)) - cmd = ["molecule", "--debug", "test", "-s", "test-scenario"] result = run_command(cmd) assert result.returncode == 0 @@ -108,6 +112,7 @@ def test_invalid_settings(temp_dir): ("provider_config_options"), ("default"), ("default-compat"), + ("box_url"), ("network"), ("hostname"), ], diff --git a/test/vagrant/scenarios/molecule/config_options/converge.yml b/test/vagrant-plugin/scenarios/molecule/box_url/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/config_options/converge.yml rename to test/vagrant-plugin/scenarios/molecule/box_url/converge.yml diff --git a/test/vagrant-plugin/scenarios/molecule/box_url/molecule.yml b/test/vagrant-plugin/scenarios/molecule/box_url/molecule.yml new file mode 100644 index 00000000..9d3fb20c --- /dev/null +++ b/test/vagrant-plugin/scenarios/molecule/box_url/molecule.yml @@ -0,0 +1,15 @@ +--- +dependency: + name: galaxy +driver: + name: vagrant + provider: + name: libvirt +platforms: + - name: instance + box: centos/stream9 + box_url: "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-Vagrant-9-20230704.1.x86_64.vagrant-libvirt.box" + box_download_checksum: "8a9fe7e8083421047e5404131daa007b4c1bcc466f3d9b29d0e7c7e432891a0e" + box_download_checksum_type: "sha256" +provisioner: + name: ansible diff --git a/test/vagrant/scenarios/molecule/default/converge.yml b/test/vagrant-plugin/scenarios/molecule/config_options/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/default/converge.yml rename to test/vagrant-plugin/scenarios/molecule/config_options/converge.yml diff --git a/test/vagrant/scenarios/molecule/config_options/molecule.yml b/test/vagrant-plugin/scenarios/molecule/config_options/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/config_options/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/config_options/molecule.yml diff --git a/test/vagrant/scenarios/molecule/config_options/verify.yml b/test/vagrant-plugin/scenarios/molecule/config_options/verify.yml similarity index 100% rename from test/vagrant/scenarios/molecule/config_options/verify.yml rename to test/vagrant-plugin/scenarios/molecule/config_options/verify.yml diff --git a/test/vagrant/scenarios/molecule/default-compat/converge.yml b/test/vagrant-plugin/scenarios/molecule/default-compat/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/default-compat/converge.yml rename to test/vagrant-plugin/scenarios/molecule/default-compat/converge.yml diff --git a/test/vagrant/scenarios/molecule/default-compat/create.yml b/test/vagrant-plugin/scenarios/molecule/default-compat/create.yml similarity index 100% rename from test/vagrant/scenarios/molecule/default-compat/create.yml rename to test/vagrant-plugin/scenarios/molecule/default-compat/create.yml diff --git a/test/vagrant/scenarios/molecule/default-compat/destroy.yml b/test/vagrant-plugin/scenarios/molecule/default-compat/destroy.yml similarity index 100% rename from test/vagrant/scenarios/molecule/default-compat/destroy.yml rename to test/vagrant-plugin/scenarios/molecule/default-compat/destroy.yml diff --git a/test/vagrant/scenarios/molecule/default-compat/molecule.yml b/test/vagrant-plugin/scenarios/molecule/default-compat/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/default-compat/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/default-compat/molecule.yml diff --git a/test/vagrant/scenarios/molecule/hostname/converge.yml b/test/vagrant-plugin/scenarios/molecule/default/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/hostname/converge.yml rename to test/vagrant-plugin/scenarios/molecule/default/converge.yml diff --git a/test/vagrant/scenarios/molecule/default/molecule.yml b/test/vagrant-plugin/scenarios/molecule/default/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/default/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/default/molecule.yml diff --git a/test/vagrant/scenarios/molecule/invalid/converge.yml b/test/vagrant-plugin/scenarios/molecule/hostname/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/invalid/converge.yml rename to test/vagrant-plugin/scenarios/molecule/hostname/converge.yml diff --git a/test/vagrant/scenarios/molecule/hostname/molecule.yml b/test/vagrant-plugin/scenarios/molecule/hostname/molecule.yml similarity index 73% rename from test/vagrant/scenarios/molecule/hostname/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/hostname/molecule.yml index c50ff93e..761515af 100644 --- a/test/vagrant/scenarios/molecule/hostname/molecule.yml +++ b/test/vagrant-plugin/scenarios/molecule/hostname/molecule.yml @@ -7,17 +7,17 @@ driver: name: libvirt platforms: - name: instance-1 - box: ${TESTBOX:-debian/jessie64} + box: ${TESTBOX:-debian/bookworm64} memory: 256 cpus: 1 - name: instance-2 hostname: instance.example.com - box: ${TESTBOX:-debian/jessie64} + box: ${TESTBOX:-debian/bookworm64} memory: 256 cpus: 1 - name: instance-3 hostname: false - box: ${TESTBOX:-debian/jessie64} + box: ${TESTBOX:-debian/bookworm64} memory: 256 cpus: 1 provisioner: diff --git a/test/vagrant/scenarios/molecule/hostname/verify.yml b/test/vagrant-plugin/scenarios/molecule/hostname/verify.yml similarity index 100% rename from test/vagrant/scenarios/molecule/hostname/verify.yml rename to test/vagrant-plugin/scenarios/molecule/hostname/verify.yml diff --git a/test/vagrant/scenarios/molecule/multi-node/converge.yml b/test/vagrant-plugin/scenarios/molecule/invalid/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/multi-node/converge.yml rename to test/vagrant-plugin/scenarios/molecule/invalid/converge.yml diff --git a/test/vagrant/scenarios/molecule/invalid/molecule.yml b/test/vagrant-plugin/scenarios/molecule/invalid/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/invalid/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/invalid/molecule.yml diff --git a/test/vagrant/scenarios/molecule/network/converge.yml b/test/vagrant-plugin/scenarios/molecule/multi-node/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/network/converge.yml rename to test/vagrant-plugin/scenarios/molecule/multi-node/converge.yml diff --git a/test/vagrant/scenarios/molecule/multi-node/molecule.yml b/test/vagrant-plugin/scenarios/molecule/multi-node/molecule.yml similarity index 62% rename from test/vagrant/scenarios/molecule/multi-node/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/multi-node/molecule.yml index 52e1488f..751bcf7e 100644 --- a/test/vagrant/scenarios/molecule/multi-node/molecule.yml +++ b/test/vagrant-plugin/scenarios/molecule/multi-node/molecule.yml @@ -7,7 +7,7 @@ driver: name: libvirt platforms: - name: instance-1 - box: ${TESTBOX:-debian/stretch64} + box: ${TESTBOX:-debian/bookworm64} interfaces: - network_name: private_network ip: 192.168.56.2 @@ -24,7 +24,7 @@ platforms: instance_raw_config_args: - 'vm.synced_folder ".", "/vagrant", type: "rsync"' - name: instance-2 - box: ${TESTBOX:-centos/7} + box: ${TESTBOX:-debian/bookworm64} interfaces: - network_name: private_network ip: 192.168.56.3 @@ -38,11 +38,5 @@ platforms: qemu_use_session: false instance_raw_config_args: - 'vm.synced_folder ".", "/vagrant", type: "rsync"' - # https://blog.centos.org/2020/05/updated-centos-vagrant-images-available-v2004-01/ - # curl http://cloud.centos.org/centos/7/vagrant/x86_64/images/sha256sum.txt.asc -o sha256sum.txt.asc - box_url: "https://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7-x86_64-Vagrant-2004_01.VirtualBox.box" - box_version: "2004.01" - box_download_checksum: "7e83943defcb5c4e9bebbe4184cce4585c82805a15e936b01b1e893b63dee2c5" - box_download_checksum_type: "sha256" provisioner: name: ansible diff --git a/test/vagrant/scenarios/molecule/multi-node/verify.yml b/test/vagrant-plugin/scenarios/molecule/multi-node/verify.yml similarity index 100% rename from test/vagrant/scenarios/molecule/multi-node/verify.yml rename to test/vagrant-plugin/scenarios/molecule/multi-node/verify.yml diff --git a/test/vagrant/scenarios/molecule/provider_config_options/converge.yml b/test/vagrant-plugin/scenarios/molecule/network/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/provider_config_options/converge.yml rename to test/vagrant-plugin/scenarios/molecule/network/converge.yml diff --git a/test/vagrant/scenarios/molecule/network/molecule.yml b/test/vagrant-plugin/scenarios/molecule/network/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/network/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/network/molecule.yml diff --git a/test/vagrant/scenarios/molecule/network/verify.yml b/test/vagrant-plugin/scenarios/molecule/network/verify.yml similarity index 100% rename from test/vagrant/scenarios/molecule/network/verify.yml rename to test/vagrant-plugin/scenarios/molecule/network/verify.yml diff --git a/test/vagrant/scenarios/molecule/vagrant_root/converge.yml b/test/vagrant-plugin/scenarios/molecule/provider_config_options/converge.yml similarity index 100% rename from test/vagrant/scenarios/molecule/vagrant_root/converge.yml rename to test/vagrant-plugin/scenarios/molecule/provider_config_options/converge.yml diff --git a/test/vagrant/scenarios/molecule/provider_config_options/molecule.yml b/test/vagrant-plugin/scenarios/molecule/provider_config_options/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/provider_config_options/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/provider_config_options/molecule.yml diff --git a/test/vagrant/scenarios/molecule/provider_config_options/verify.yml b/test/vagrant-plugin/scenarios/molecule/provider_config_options/verify.yml similarity index 100% rename from test/vagrant/scenarios/molecule/provider_config_options/verify.yml rename to test/vagrant-plugin/scenarios/molecule/provider_config_options/verify.yml diff --git a/test/vagrant-plugin/scenarios/molecule/vagrant_root/converge.yml b/test/vagrant-plugin/scenarios/molecule/vagrant_root/converge.yml new file mode 100644 index 00000000..a63f9e8d --- /dev/null +++ b/test/vagrant-plugin/scenarios/molecule/vagrant_root/converge.yml @@ -0,0 +1,10 @@ +--- +- name: Converge + hosts: all + gather_facts: false + become: true + tasks: + - name: Sample task # noqa command-instead-of-shell + ansible.builtin.shell: + cmd: uname + changed_when: false diff --git a/test/vagrant/scenarios/molecule/vagrant_root/molecule.yml b/test/vagrant-plugin/scenarios/molecule/vagrant_root/molecule.yml similarity index 100% rename from test/vagrant/scenarios/molecule/vagrant_root/molecule.yml rename to test/vagrant-plugin/scenarios/molecule/vagrant_root/molecule.yml diff --git a/test/vagrant/scenarios/molecule/vagrant_root/verify.yml b/test/vagrant-plugin/scenarios/molecule/vagrant_root/verify.yml similarity index 100% rename from test/vagrant/scenarios/molecule/vagrant_root/verify.yml rename to test/vagrant-plugin/scenarios/molecule/vagrant_root/verify.yml diff --git a/test/vagrant/test_driver.py b/test/vagrant-plugin/test_driver.py similarity index 100% rename from test/vagrant/test_driver.py rename to test/vagrant-plugin/test_driver.py diff --git a/tox.ini b/tox.ini index f6b0cd3f..ee38120a 100644 --- a/tox.ini +++ b/tox.ini @@ -48,6 +48,7 @@ setenv = # This should pass these args to molecule, no effect here as this is the default # but it validates that it accepts extra params. MOLECULE_OPTS=--destroy always + TESTBOX={env:TESTBOX:testbox} passenv = CI CURL_CA_BUNDLE