Skip to content

Commit

Permalink
squash: Simplify test, release note, short spec
Browse files Browse the repository at this point in the history
  • Loading branch information
psss committed Feb 2, 2024
1 parent f93ed22 commit e968256
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
4 changes: 4 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ New hardware specification key :ref:`/spec/hardware/zcrypt` has
been defined. It will be used for selecting guests with the given
`System z cryptographic adapter`.

A prepare step plugin :ref:`/spec/plans/prepare/feature` has been
implemented. As the first supported feature, ``epel`` repositories
can now be enabled using a concise configuration.


tmt-1.30
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
19 changes: 19 additions & 0 deletions spec/plans/prepare.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ example: |
- implemented-by: /tmt/steps/provision
- verified-by: /tests/prepare/ansible

/feature:
summary:
Easily enable and disable common features
description: |
The ``feature`` plugin provides a comfortable way to
enable and disable some commonly used functionality. As
for now enabling and disabling the ``epel`` repository is
supported, ``crb`` and ``fips`` are coming in the near
future.

.. versionadded:: 1.31
example: |
prepare:
how: feature
epel: enabled
link:
- implemented-by: /tmt/steps/prepare/feature
- verified-by: /tests/prepare/feature

/install:
summary:
Install packages on the guest
Expand Down
11 changes: 1 addition & 10 deletions tests/prepare/feature/main.fmf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
summary: Common feature to enable/disable EPEL
description:
Make sure enable/disable EPEL work.
environment:
PROVISION_METHODS: container virtual connect local
adjust:
- when: trigger == commit
environment:
PROVISION_METHODS: container
- when: how == full
environment:
PROVISION_METHODS: container virtual
Make sure enable/disable EPEL works.
19 changes: 8 additions & 11 deletions tests/prepare/feature/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ rlJournalStart
rlRun "pushd data"
rlPhaseEnd

# Define images if provision method is 'container'
images=${PROVISION_CONTAINER_IMAGES:-"centos:stream9 centos:stream8"}
images="centos:stream9 centos:stream8 ubi9 ubi8"

# EPEL
for method in ${PROVISION_METHODS:-"container"}; do
for image in $images; do
rlPhaseStartTest "Enable EPEL"
rlRun -s "tmt -vvv run -a plan --name '/epel/enabled' provision --how $method --image $image"
rlPhaseEnd
for image in $images; do
rlPhaseStartTest "Enable EPEL on $image"
rlRun -s "tmt -vvv run -a plan --name '/epel/enabled' provision --how container --image $image"
rlPhaseEnd

rlPhaseStartTest "Disable EPEL"
rlRun -s "tmt -vvv run -a plan --name '/epel/disabled' provision --how $method --image $image"
rlPhaseEnd
done
rlPhaseStartTest "Disable EPEL on $image"
rlRun -s "tmt -vvv run -a plan --name '/epel/disabled' provision --how container --image $image"
rlPhaseEnd
done

rlPhaseStartCleanup
Expand Down
10 changes: 5 additions & 5 deletions tmt/steps/prepare/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def get_root_path(self) -> Path:
assert self.parent is not None # narrow type
assert self.parent.parent is not None # narrow type
assert self.parent.parent.parent is not None # narrow type
parent3 = cast(tmt.base.Plan, self.parent.parent.parent)
assert parent3.my_run is not None # narrow type
assert parent3.my_run.tree is not None # narrow type
assert parent3.my_run.tree.root is not None # narrow type
return parent3.my_run.tree.root
plan = cast(tmt.base.Plan, self.parent.parent.parent)
assert plan.my_run is not None # narrow type
assert plan.my_run.tree is not None # narrow type
assert plan.my_run.tree.root is not None # narrow type
return plan.my_run.tree.root

def _run_playbook(self, op: str, playbook_filename: str) -> None:
playbook_path = self._find_playbook(playbook_filename)
Expand Down

0 comments on commit e968256

Please sign in to comment.