跳转到主要内容

Vagrant Molecule 插件 :: 使用 Vagrant 运行 molecule 测试

项目描述

PyPI Package https://zuul-ci.org/gated.svg Python Black Code Style Ansible Code of Conduct Ansible mailing lists Repository License

Molecule Vagrant 设计用于允许使用 Vagrant 来配置测试资源。

支持的平台

此驱动程序依赖于已知的在多个平台上安装有问题的 vagrant 命令行。我们尽最大努力在多个平台上执行 CI/CD 测试,但一些因已知错误而被禁用。

  • ✅ MacOS 与 VirtualBox - GitHub Actions

  • ✅ Fedora 32 与 libvirt - Zuul

  • ✅ Ubuntu Bionic (18.04) 与 libvirt - Zuul

  • ❌ CentOS 8 with libvirt - Zuul 已禁用,原因在于 112711020

请勿为不支持的平台提交错误报告。欢迎您创建修复未测试平台的 Pull Request,只要它们不会破坏现有的功能。

文档

要使用此插件,您需要在您的 molecule.yml 中设置 driverplatform 变量。以下是一个使用 fedora/32-cloud-base 虚拟机的简单示例

driver:
  name: vagrant

platforms:
  - name: instance
    box: fedora/32-cloud-base
    memory: 512
    cpus: 1

以下是一个使用 libvirt 提供程序的完整示例

driver:
  name: vagrant
  provider:
    # Can be any supported provider (virtualbox, parallels, libvirt, etc)
    # Defaults to virtualbox
    name: libvirt
  # Run vagrant up with --provision.
  # Defaults to --no-provision)
  provision: no
  # vagrant-cachier configuration
  # Defaults to 'machine'
  # Any value different from 'machine' or 'box' will disable it
  cachier: machine
  # If set to false, set VAGRANT_NO_PARALLEL to '1'
  # Defaults to true
  parallel: true
  # vagrant box to use by default
  # Defaults to 'generic/alpine316'
  default_box: 'generic/alpine316'

platforms:
  - name: instance
    # If specified, set host name to hostname, unless it's set to False and
    # the host name won't be set. In all other cases (including default) use
    # 'name' as host name.
    hostname: foo.bar.com
    # List of dictionaries mapped to `config.vm.network`
    interfaces:
      # `network_name` is the required identifier, all other keys map to
      # arguments.
      - auto_config: true
        network_name: private_network
        type: dhcp
      - network_name: private_network
        ip: 192.168.123.3
      - network_name: forwarded_port
        guest: 80
        host: 8080
    # List of raw Vagrant `config` options
    instance_raw_config_args:
      # use single quotes to avoid YAML parsing as dict due to ':'
      - 'vm.synced_folder ".", "/vagrant", type: "rsync"'
      # Run 'uname' a provisionning step **needs 'provision: true' to work**
      - 'vm.provision :shell, inline: "uname"'
    # Dictionary of `config` options. Note that string values need to be
    # explicitly enclosed in quotes.
    config_options:
      ssh.keep_alive: yes
      ssh.remote_user: 'vagrant'
      synced_folder: true
    box: fedora/32-cloud-base
    box_version: 32.20200422.0
    box_url:
    memory: 512
    cpus: 1
    # Dictionary of options passed to the provider
    provider_options:
      video_type: 'vga'
    # List of raw provider options
    provider_raw_config_args:
      - cpuset = '1-4,^3,6'

更多示例可以在 molecule场景目录 中找到。它们是 CI 使用的场景。

参与其中

作者

Molecule Vagrant 插件由 Sorin Sbarnea 创建,基于 Molecule 的代码。

许可证

MIT 许可证。

标志受 Creative Commons NoDerivatives 4.0 许可 限制。

如果您有其他用途,请联系我们。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分发

molecule-vagrant-2.0.0.tar.gz (31.9 kB 查看哈希值)

上传时间 源代码

构建分发

molecule_vagrant-2.0.0-py3-none-any.whl (33.5 kB 查看哈希值)

上传时间 Python 3

支持者