Skip to content

Commit

Permalink
behave: new test for dnf4 chroot without bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Sep 30, 2024
1 parent 516144a commit 3c942f2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions behave/features/dnf4.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Mock is able to work with dnf4 chroots

@dnf4
Scenario: Building a DNF4 chroot without bootstrap chroot
Given an unique mock namespace
And mock is always executed with "--no-bootstrap-chroot"
When an online source RPM is rebuilt against centos-stream+epel-9-x86_64
Then the build succeeds
12 changes: 10 additions & 2 deletions behave/features/steps/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,19 @@ def step_impl(context, expected_message):
assert_that(err[0], contains_string(expected_message))


def _rebuild_online(context, chroot=None):
url = context.test_storage + "mock-test-bump-version-1-0.src.rpm"
context.mock.rebuild([url], chroot)


@when('an online source RPM is rebuilt')
def step_impl(context):
url = context.test_storage + "mock-test-bump-version-1-0.src.rpm"
context.mock.rebuild([url])
_rebuild_online(context)


@when('an online source RPM is rebuilt against {chroot}')
def step_impl(context, chroot):
_rebuild_online(context, chroot)

@then('{output} contains "{text}"')
def step_impl(context, output, text):
Expand Down
7 changes: 5 additions & 2 deletions behave/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ def init(self):
}]
return out, err

def rebuild(self, srpms):
def rebuild(self, srpms, chroot=None):
""" Rebuild source RPM(s) """

chrootspec = []
if self.context.custom_config:
if chroot:
chrootspec += ["-r", chroot]
self.context.chroot = chroot
elif self.context.custom_config:
config_file = Path(self.context.workdir) / "custom.cfg"
with config_file.open("w") as fd:
fd.write(f"include('{self.context.chroot}.cfg')\n")
Expand Down

0 comments on commit 3c942f2

Please sign in to comment.