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 basic tests using packit #818

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
24 changes: 0 additions & 24 deletions .github/workflows/ruby_tests.yml

This file was deleted.

24 changes: 16 additions & 8 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ specfile_path: rubygem-foreman_maintain.spec

# add or remove files that should be synced
files_to_sync:
- rubygem-foreman_maintain.spec
- foreman_maintain.logrotate
- .packit.yaml
- rubygem-foreman_maintain.spec
- foreman_maintain.logrotate

# name in upstream package repository or registry (e.g. in PyPI)
upstream_package_name: foreman_maintain
Expand All @@ -30,14 +29,23 @@ jobs:
- job: copr_build
trigger: pull_request
targets:
rhel-8:
additional_modules: "foreman:el8"
additional_repos:
- https://yum.theforeman.org/releases/nightly/el8/x86_64/
rhel-9:
additional_repos:
- https://yum.theforeman.org/releases/nightly/el9/x86_64/
- https://yum.theforeman.org/releases/nightly/el$releasever/$basearch/
module_hotfixes: true
- job: tests
trigger: pull_request
targets:
rhel-9-x86_64:
distros:
- centos-stream-9
tf_extra_params:
environments:
- artifacts:
- type: repository
id: https://yum.theforeman.org/releases/nightly/el9/x86_64/
packages:
- foreman-release

srpm_build_deps:
- wget
Expand Down
11 changes: 11 additions & 0 deletions plans/help.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary: Run with --help
prepare:
- how: ansible
playbook: playbooks/stagingyum.yml
- how: install
package:
# https://github.com/theforeman/foreman-packaging/pull/10670
- hostname
- foreman-maintain
execute:
- script: foreman-maintain --help
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why --help triggers hostname?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. It's either this:

def hostname
execute('hostname -f')
end

But more likely this:

@foreman_url = @options.fetch(:foreman_url, `hostname -f`.chomp)

That latter should really use block form:

@foreman_url = @options.fetch(:foreman_url) { `hostname -f`.chomp }

That way it doesn't execute hostname -f if a value is found.

Copy link
Member

Choose a reason for hiding this comment

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

You could, in theory, use this PR to test both this PR and the theory? By including these pieces of code selectively commented out and removing the hostname requires. Kind of a fun experiment.

Copy link
Member Author

Choose a reason for hiding this comment

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

#819. And there's already plenty of other things I'm trying to test. First I just want it to work.

11 changes: 11 additions & 0 deletions playbooks/stagingyum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- hosts: all
vars:
foreman_repositories_version: nightly
tasks:
- name: 'Foreman {{ foreman_repositories_version }} Staging repository'
yum_repository:
name: foreman-staging
description: "Foreman {{ foreman_repositories_version }} Staging Repository"
baseurl: "https://stagingyum.theforeman.org/foreman/{{ foreman_repositories_version }}/el$releasever_major/$basearch/"
gpgcheck: false