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

Tests for check --dependencies and repoquery --requires-pre with %pre and %post #663

Merged
merged 2 commits into from Mar 5, 2020
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
67 changes: 63 additions & 4 deletions dnf-behave-tests/features/check-dependencies.feature
@@ -1,12 +1,9 @@
Feature: Check when there is a package with missing dependency


Background: Force installation of an RPM without dependencies
Scenario Outline: Check <option>
When I execute rpm with args "-i --nodeps {context.dnf.fixturesdir}/repos/dnf-ci-fedora/x86_64/filesystem-3.9-2.fc29.x86_64.rpm"
Then the exit code is 0


Scenario Outline: Check <option>
When I execute dnf with args "check <option>"
Then the exit code is 1
And stdout contains "filesystem-3.9-2.fc29.x86_64 has missing requires of setup"
Expand All @@ -24,6 +21,8 @@ Examples:


Scenario Outline: Check <option>
When I execute rpm with args "-i --nodeps {context.dnf.fixturesdir}/repos/dnf-ci-fedora/x86_64/filesystem-3.9-2.fc29.x86_64.rpm"
Then the exit code is 0
When I execute dnf with args "check <option>"
Then the exit code is 0
And stdout is empty
Expand All @@ -34,3 +33,63 @@ Examples:
| --duplicates |
| --obsoleted |
| --provides |


@bz1543449
Scenario: Removed scriptlet pre and post dependencies are not reported as missing
Given I use repository "dnf-ci-check-dependencies"
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK the names of repositories that belong to single feature files so far don't have the "dnf-ci-" prefix, so let's keep it consistent? (and name the repository just check-dependencies?)

On a side note, I'm still worried it's becoming a bit of a mess, that's why I wanted to agree on some rules a while ago...

Copy link
Contributor Author

@kontura kontura Oct 29, 2019

Choose a reason for hiding this comment

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

I see, I have updated it to check-dependencies.
Thanks.

I agree, it confused me at least.

And I successfully execute dnf with args "install package-requires-all-scriptlets"
And I successfully execute dnf with args "remove dependency-1 dependency-2"
When I execute dnf with args "check --dependencies"
Then the exit code is 0
And stdout is empty
And stderr is empty


Scenario: Removed requires(pre) dependency is reported if it is also requires
Given I use repository "dnf-ci-check-dependencies"
And I successfully execute dnf with args "install package-requires-and-requires-pre"
And I successfully execute rpm with args "--erase --nodeps dependency-1"
When I execute dnf with args "check --dependencies"
Then the exit code is 1
And stdout is
"""
package-requires-and-requires-pre-1.0-1.x86_64 has missing requires of dependency-1
"""
And stderr is
"""
Error: Check discovered 1 problem(s)
"""


Scenario: Removed requires(pre) dependency is reported if it is also requires(preun)
Given I use repository "dnf-ci-check-dependencies"
And I successfully execute dnf with args "install package-requires-pre-and-requires-preun"
And I successfully execute rpm with args "--erase --nodeps dependency-1"
When I execute dnf with args "check --dependencies"
Then the exit code is 1
And stdout is
"""
package-requires-pre-and-requires-preun-1.0-1.x86_64 has missing requires of dependency-1
"""
And stderr is
"""
Error: Check discovered 1 problem(s)
"""


Scenario: Removed scriptlet preun and postun dependencies are reported as missing
Given I use repository "dnf-ci-check-dependencies"
And I successfully execute dnf with args "install package-requires-all-scriptlets"
And I successfully execute rpm with args "--erase --nodeps dependency-3 dependency-4"
When I execute dnf with args "check --dependencies"
Then the exit code is 1
And stdout is
"""
package-requires-all-scriptlets-1.0-1.x86_64 has missing requires of dependency-3
package-requires-all-scriptlets-1.0-1.x86_64 has missing requires of dependency-4
"""
And stderr is
"""
Error: Check discovered 2 problem(s)
"""
51 changes: 50 additions & 1 deletion dnf-behave-tests/features/repoquery/deps.feature
@@ -1,5 +1,5 @@
Feature: Tests for the basic repoquery dependencies functionality:
--requires, --provides, --conflicts, --obsoletes
--requires, --provides, --conflicts, --obsoletes, --requires-pre
--whatrequires, --whatprovides, --whatconflicts, --whatobsoletes

Background:
Expand Down Expand Up @@ -121,6 +121,30 @@ Scenario: repoquery --requires NAMEGLOB-VERSION NAME
bottom3-prov1
"""

Scenario: repoquery --requires with requires(pre/post/preun/postun)
When I execute dnf with args "repoquery --requires middle3-1.0-1"
Then the exit code is 0
And stdout is
"""
bottom1-prov1
bottom3-prov1
bottom4-prov1
bottom5-prov1
"""

# Using --qf .. is a diffrent code path in repoquery
Scenario: repoquery --requires with requires(pre/post/preun/postun)
When I execute dnf with args "repoquery --qf '%{{requires}}' middle3-1.0-1"
Then the exit code is 0
And stdout is
"""

bottom1-prov1
bottom3-prov1
bottom4-prov1
bottom5-prov1
"""


# --provides
Scenario: repoquery --provides NAME
Expand Down Expand Up @@ -264,6 +288,7 @@ Scenario: repoquery --whatrequires NAME (file provide)
And stdout is
"""
middle1-1:2.0-1.x86_64
middle3-1:1.0-1.x86_64
"""

Scenario: repoquery --whatrequires PROVIDE_NAME
Expand Down Expand Up @@ -569,3 +594,27 @@ Scenario: repoquery --whatobsoletes NAME, NAME = VERSION
middle2-1:1.0-1.x86_64
middle2-1:2.0-1.x86_64
"""


# --requires-pre
Scenario: repoquery --requires-pre
When I execute dnf with args "repoquery --requires-pre middle3"
Then the exit code is 0
And stdout is
"""
bottom1-prov1
bottom3-prov1
"""

Scenario: repoquery --requires-pre with installed pkg show all %pre, %post, %preun, %postun deps
Given I successfully execute dnf with args "install middle3"
And I drop repository "repoquery-deps"
When I execute dnf with args "repoquery --installed --requires-pre middle3"
Then the exit code is 0
And stdout is
"""
bottom1-prov1
bottom3-prov1
bottom4-prov1
bottom5-prov1
"""
@@ -0,0 +1,16 @@
Name: dependency-1
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for dependency scriptlets testing.

%description
The made up package for dependency scriptlets testing.

%files

%changelog
@@ -0,0 +1,17 @@
Name: dependency-2
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for dependency scriptlets testing.

%description
The made up package for dependency scriptlets testing.


%files

%changelog
@@ -0,0 +1,16 @@
Name: dependency-3
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for dependency scriptlets testing.

%description
The made up package for dependency scriptlets testing.

%files

%changelog
@@ -0,0 +1,16 @@
Name: dependency-4
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for dependency scriptlets testing.

%description
The made up package for dependency scriptlets testing.

%files

%changelog
@@ -0,0 +1,21 @@
Name: package-requires-all-scriptlets
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for scriptlets testing.

Requires(pre): dependency-1
Requires(post): dependency-2
Requires(preun): dependency-3
Requires(postun): dependency-4

%description
test package for Requires(pre/post/preun/postun)

%files

%changelog
@@ -0,0 +1,19 @@
Name: package-requires-and-requires-pre
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for dependencies

Requires(pre): dependency-1
Requires: dependency-1

%description
test package for Requires(pre/post) and Requires

%files

%changelog
@@ -0,0 +1,19 @@
Name: package-requires-pre-and-requires-preun
Epoch: 0
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: The made up package for dependencies

Requires(pre): dependency-1
Requires(preun): dependency-1

%description
test package for Requires(pre/post) and Requires

%files

%changelog
@@ -0,0 +1,18 @@
Name: bottom5
Epoch: 1
Version: 1.0
Release: 1

License: Public Domain
URL: None

Provides: bottom5-prov1

Summary: Bottom level package (other packages depend on it).

%description
Dummy.

%files

%changelog
@@ -0,0 +1,21 @@
Name: middle3
Epoch: 1
Version: 1.0
Release: 1

License: Public Domain
URL: None

Requires(post): bottom1-prov1
Requires(pre): bottom3-prov1
Requires(postun): bottom4-prov1
Requires(preun): bottom5-prov1

Summary: Mid level package.

%description
Dummy.

%files

%changelog