Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yum integration tests using fake repo #31646

Merged
merged 1 commit into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions test/integration/targets/yum/files/create-repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python


import sys
from collections import namedtuple
import rpmfluff


RPM = namedtuple('RPM', ['name', 'version', 'release', 'epoch'])


SPECS = [
RPM('foo', '1.0', '1', None),
RPM('foo', '1.0', '2', '1'),
RPM('foo', '1.1', '1', '1'),
]


def main():
try:
arch = sys.argv[1]
except IndexError:
arch = 'x86_64'

pkgs = []
for spec in SPECS:
pkg = rpmfluff.SimpleRpmBuild(spec.name, spec.version, spec.release, [arch])
pkg.epoch = spec.epoch
pkgs.append(pkg)

repo = rpmfluff.YumRepoBuild(pkgs)
repo.make(arch)

for pkg in pkgs:
pkg.clean()

print(repo.repoDir)


if __name__ == "__main__":
main()
5 changes: 5 additions & 0 deletions test/integration/targets/yum/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
- ansible_python.version.major == 2

- include: 'repo.yml'
when:
- ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
- ansible_python.version.major == 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you are just copying the task from above, though why doesn't this work on py3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The yum module uses some of yum's python API, so my guess is that that's the reason, yum is old :)


# We can't run yum --installroot tests on dnf systems. Dnf systems revert to
# yum-deprecated, and yum-deprecated refuses to run if yum.conf exists
# so we cannot configure yum-deprecated correctly in an empty /tmp/fake.root/
Expand Down