From 340407e3017aab04b8407571c93b7ca49cff19d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Tue, 19 Sep 2023 08:15:00 +0200 Subject: [PATCH] repoquery: add file tests --- dnf-behave-tests/dnf/repoquery/files.feature | 48 +++++++++++++++++++ .../specs/repoquery-files/a-1.0-1.fc29.spec | 21 ++++++++ 2 files changed, 69 insertions(+) create mode 100644 dnf-behave-tests/dnf/repoquery/files.feature create mode 100644 dnf-behave-tests/fixtures/specs/repoquery-files/a-1.0-1.fc29.spec diff --git a/dnf-behave-tests/dnf/repoquery/files.feature b/dnf-behave-tests/dnf/repoquery/files.feature new file mode 100644 index 000000000..34237d8d7 --- /dev/null +++ b/dnf-behave-tests/dnf/repoquery/files.feature @@ -0,0 +1,48 @@ +@dnf5 +Feature: Repoquery tests working with files + + +Scenario: list files in an rpm including files in filelists.xml +Given I use repository "repoquery-files" + When I execute dnf with args "repoquery a.x86_64 --files" + Then the exit code is 0 + And stdout is + """ + + /root-file + /usr/bin/a-binary + """ + + +Scenario: list files using --queryformat in an rpm including files in filelists.xml +Given I use repository "repoquery-files" + When I execute dnf with args "repoquery a.x86_64 --qf %{{files}}" + Then the exit code is 0 + And stdout is + """ + + /root-file + /usr/bin/a-binary + """ + + +Scenario: filter by file in primary.xml +Given I use repository "repoquery-files" + When I execute dnf with args "repoquery --file /usr/bin/a-binary" + Then the exit code is 0 + And stdout is + """ + + a-0:1.0-1.fc29.x86_64 + """ + + +Scenario: filter by file in filelists.xml +Given I use repository "repoquery-files" + When I execute dnf with args "repoquery --file /root-file" + Then the exit code is 0 + And stdout is + """ + + a-0:1.0-1.fc29.x86_64 + """ diff --git a/dnf-behave-tests/fixtures/specs/repoquery-files/a-1.0-1.fc29.spec b/dnf-behave-tests/fixtures/specs/repoquery-files/a-1.0-1.fc29.spec new file mode 100644 index 000000000..05b22ba9e --- /dev/null +++ b/dnf-behave-tests/fixtures/specs/repoquery-files/a-1.0-1.fc29.spec @@ -0,0 +1,21 @@ +Name: a +Version: 1.0 +Release: 1.fc29 +Summary: Made up package + +License: GPLv3+ +Url: None + +%description +a description + +%install +mkdir -p %{buildroot}%{_bindir} +touch %{buildroot}%{_bindir}/a-binary +touch %{buildroot}/root-file + +%files +%{_bindir}/a-binary +/root-file + +%changelog