Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
audgirka committed Aug 10, 2023
1 parent 7a37dd5 commit e9e15c5
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ tools/test-schema/node_modules
site
.DS_Store
src/molecule/_version.py
.vscode
34 changes: 34 additions & 0 deletions src/molecule/test/b_functional/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from __future__ import annotations

import os
import subprocess

import pytest
from pytest import FixtureRequest
Expand Down Expand Up @@ -336,6 +337,39 @@ def test_sample_collection() -> None:
)


def test_sample_collection_venv_with_gitignore() -> None:
op = subprocess.run(
"python -m venv venv \
&& source venv/bin/activate \
&& pip install ../../../../../ \
&& molecule list \
&& deactivate \
&& rm -rf source venv",
shell=True,
cwd="src/molecule/test/resources/sample-collection-venv-with-gitignore",
check=True,
)
assert op.returncode == 0


def test_sample_collection_venv_without_gitignore() -> None:
with pytest.raises(subprocess.CalledProcessError) as e:
subprocess.run(
"python -m venv venv \
&& source venv/bin/activate \
&& pip install ../../../../../ \
&& molecule list \
&& deactivate \
&& rm -rf source venv",
shell=True,
cwd="src/molecule/test/resources/sample-collection-venv-without-gitignore",
check=True,
)
assert e.value.returncode == 1
assert "The scenario config file" in e.value.stderr
assert "has been modified since the scenario was created" in e.value.stderr


def test_podman() -> None:
assert (
run_command(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
source/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Converge
hosts: localhost
tasks:
- name: "Include sample role from current collection"
ansible.builtin.include_role:
name: acme.goodies.get_rich
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
dependency:
name: galaxy
driver:
name: default
platforms:
- name: instance
provisioner:
name: ansible
verifier:
name: ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: goodies
namespace: acme
version: 1.0.0
readme: README.md
authors:
- Red Hat
description: Acme Goodies Collection
build_ignore:
- "*.egg-info"
- .DS_Store
- .eggs
- .gitignore
- .mypy_cache
- .pytest_cache
- .stestr
- .stestr.conf
- .tox
- .vscode
- MANIFEST.in
- build
- dist
- doc
- report.html
- setup.cfg
- setup.py
- "tests/unit/*.*"
- README.rst
- tox.ini

repository: https://opendev.org/openstack/tripleo-repos
license_file: LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: "some task inside foo.bar collection"
ansible.builtin.debug:
msg: "hello world!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Converge
hosts: localhost
tasks:
- name: "Include sample role from current collection"
ansible.builtin.include_role:
name: acme.goodies.get_rich
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
dependency:
name: galaxy
driver:
name: default
platforms:
- name: instance
provisioner:
name: ansible
verifier:
name: ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: goodies
namespace: acme
version: 1.0.0
readme: README.md
authors:
- Red Hat
description: Acme Goodies Collection
build_ignore:
- "*.egg-info"
- .DS_Store
- .eggs
- .gitignore
- .mypy_cache
- .pytest_cache
- .stestr
- .stestr.conf
- .tox
- .vscode
- MANIFEST.in
- build
- dist
- doc
- report.html
- setup.cfg
- setup.py
- "tests/unit/*.*"
- README.rst
- tox.ini

repository: https://opendev.org/openstack/tripleo-repos
license_file: LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: "some task inside foo.bar collection"
ansible.builtin.debug:
msg: "hello world!"

0 comments on commit e9e15c5

Please sign in to comment.