Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions container-test
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ class BehaveRunner(object):
tags = []
if hasattr(self.command_line_args, 'noxfail') and self.command_line_args.noxfail:
tags.append('~xfail')
# For a transition period ignore "@dnf5" tag passed on the commandline.
# We run dnf5 by default.
# TODO(amatej): This could be removed later
if "dnf5" in tags:
tags.remove("dnf5")
return tags

def parse_behave_dry_run(self, output):
Expand Down
127 changes: 6 additions & 121 deletions dnf-behave-tests/common/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
from common.lib.text import lines_match_to_regexps_line_by_line


sync_line_dnf4 = re.compile(r".*[0-9.]+ +[kMG]?B/s \| +[0-9.]+ +[kMG]?B +[0-9]{2}:[0-9]{2}")
bottom_line_dnf4 = re.compile(r"Last metadata expiration check: .*")

def strip_reposync_dnf4(found_lines, line_number):
while line_number < len(found_lines) and sync_line_dnf4.fullmatch(found_lines[line_number].strip()):
found_lines.pop(line_number)

if line_number < len(found_lines) and bottom_line_dnf4.fullmatch(found_lines[line_number].strip()):
found_lines.pop(line_number)


sync_line_dnf5 = re.compile(
r".* [0-9?]+% \| +[0-9.]+ +[KMG]?i?B/s \| +[\-0-9.]+ +[KMG]?i?B \| + [0-9hms?]+")

Expand All @@ -40,14 +29,11 @@ def strip_reposync_dnf5(found_lines, line_number):
while line_number < len(found_lines) and sync_line_dnf5.fullmatch(found_lines[line_number].strip()):
found_lines.pop(line_number)

def handle_reposync(expected, found, dnf5_mode):
def handle_reposync(expected, found):
line_number = 0
for line in expected:
if line == "<REPOSYNC>":
if dnf5_mode:
strip_reposync_dnf5(found, line_number)
else:
strip_reposync_dnf4(found, line_number)
strip_reposync_dnf5(found, line_number)

expected.pop(line_number)
break
Expand Down Expand Up @@ -83,8 +69,7 @@ def then_stdout_is(context):
if found == [""]:
found = []

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
clean_expected, clean_found = handle_reposync(expected, found, dnf5_mode)
clean_expected, clean_found = handle_reposync(expected, found)

if clean_expected == clean_found:
return
Expand All @@ -107,12 +92,6 @@ def then_stdout_is(context):
raise AssertionError("Stdout is not: %s" % context.text)


@parse.with_pattern(r"dnf4|dnf5")
def parse_dnf_version(text):
return text
behave.register_type(dnf_version=parse_dnf_version)


@parse.with_pattern(r"stdout|stderr")
def parse_std_stream(text):
return text
Expand All @@ -128,8 +107,7 @@ def then_stdout_matches_line_by_line(context):
found = context.cmd_stdout.split('\n')
expected = context.text.split('\n')

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
clean_expected, clean_found = handle_reposync(expected, found, dnf5_mode)
clean_expected, clean_found = handle_reposync(expected, found)

lines_match_to_regexps_line_by_line(clean_found, clean_expected)

Expand All @@ -155,8 +133,7 @@ def then_stderr_is(context):
if found == [""]:
found = []

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
clean_expected, clean_found = handle_reposync(expected, found, dnf5_mode)
clean_expected, clean_found = handle_reposync(expected, found)

if clean_expected == clean_found:
return
Expand Down Expand Up @@ -188,98 +165,6 @@ def then_stderr_matches_line_by_line(context):
found = context.cmd_stderr.split('\n')
expected = context.text.split('\n')

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
clean_expected, clean_found = handle_reposync(expected, found, dnf5_mode)
clean_expected, clean_found = handle_reposync(expected, found)

lines_match_to_regexps_line_by_line(clean_found, clean_expected)


@behave.then("{dnf_version:dnf_version} exit code is {exitcode}")
def then_dnf_exit_code_is(context, dnf_version, exitcode):
"""
Check for the test's exit code only if running in the
appropriate mode otherwise the step is skipped
Produce the steps:
then dnf4 exit code is
then dnf5 exit code is
"""
dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
if dnf_version == "dnf5" and dnf5_mode:
then_the_exit_code_is(context, exitcode)
if dnf_version == "dnf4" and not dnf5_mode:
then_the_exit_code_is(context, exitcode)


@behave.then("{dnf_version:dnf_version} {std_stream:std_stream} is")
def then_dnf_stream_is(context, dnf_version, std_stream):
"""
Check for exact match of the test's stdout/stderr
only if running in the appropriate mode otherwise
the step is skipped.
Produce the steps:
then dnf4 stdout is
then dnf4 stderr is
then dnf5 stderr is
then dnf5 stdout is
"""
if std_stream == "stdout":
then_stream_is = then_stdout_is
if std_stream == "stderr":
then_stream_is = then_stderr_is

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
if dnf_version == "dnf5" and dnf5_mode:
then_stream_is(context)
if dnf_version == "dnf4" and not dnf5_mode:
then_stream_is(context)


@behave.then("{dnf_version:dnf_version} {std_stream:std_stream} matches line by line")
def then_dnf_stream_matches_line_by_line(context, dnf_version, std_stream):
"""
Checks that each line of stdout/stderr matches respective
line in regular expressions.
Supports the <REPOSYNC> in the same way as the step
"stdout is"
Works only if running in the appropriate mode otherwise
the step is skipped.
Produce the steps:
then dnf4 stdout matches line by line
then dnf4 stderr matches line by line
then dnf5 stderr matches line by line
then dnf5 stdout matches line by line
"""
if std_stream == "stdout":
then_stream_matches_line_by_line = then_stdout_matches_line_by_line
if std_stream == "stderr":
then_stream_matches_line_by_line = then_stderr_matches_line_by_line

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
if dnf_version == "dnf5" and dnf5_mode:
then_stream_matches_line_by_line(context)
if dnf_version == "dnf4" and not dnf5_mode:
then_stream_matches_line_by_line(context)


@behave.then("{dnf_version:dnf_version} {std_stream:std_stream} is empty")
def then_dnf_stream_is_empty(context, dnf_version, std_stream):
"""
Check that stdout/stderr is empty
Works only if running in the appropriate mode otherwise
the step is skipped
Produce the steps:
then dnf4 stdout is empty
then dnf4 stderr is empty
then dnf5 stdout is empty
then dnf5 stderr is empty
"""
if std_stream == "stdout":
then_stream_is_empty = then_stdout_is_empty
if std_stream == "stderr":
then_stream_is_empty = then_stderr_is_empty

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
if dnf_version == "dnf5" and dnf5_mode:
then_stream_is_empty(context)
if dnf_version == "dnf4" and not dnf5_mode:
then_stream_is_empty(context)
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/aliases.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# aliases configuration directories are always taken from the host
@destructive
@dnf5
Feature: Test for dnf5 aliases functionality

Background:
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/api/package-query.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
@not.with_dnf=4
Feature: api: query packages

Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/api/package.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: api: package


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/api/repo-query.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: api: query repos


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
@not.with_dnf=4
Feature: transaction: remove a package with dependency, then install the dependency again

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
@not.with_dnf=4
Feature: transaction: install a package without dependencies

Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/api/transaction-test.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: transaction: dry-run a transaction


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: transaction: upgrades and downgrades

Background: Install RPMs
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/append_options.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: DNF test of append option

# The excludepks append option was choosen for testing.
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/autoremove.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Feature: Autoremoval of unneeded packages

@dnf5
Scenario: Autoremoval of package which became non-required by others
Given I use repository "dnf-ci-fedora"
And I use repository "dnf-ci-thirdparty"
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/broken-dependencies-report.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Reporting broken dependencies with various strict, best options


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/cache.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Tests for cache


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/cacheonly.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Tests for cacheonly functionality


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/check-all.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Check when there are multiple problems


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/check-dependencies.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Check when there is a package with missing dependency


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/check-duplicates.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Check when there are duplicate packages


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/check-no-problem.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Check when there is no problem


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/check-obsoleted.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Check when there is a package that obsoletes another installed package


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/check-update.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: check-upgrade commands

@bz1769466
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/clean-cachefiles.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
@dnf5daemon
Feature: Testing that dnf clean command removes files from the cache

Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/clean-requirements-on-remove.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Autoremoval of unneeded packages

Scenario: Remove with --setopt=clean_requirements_on_remove=True
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/clean.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Testing dnf clean command


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/command-aliases.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Tests for command aliases availability


Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/comps-group-disabled-repo.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Test group remove when repositories are disabled

Background: Install group DNF-CI-Testgroup
Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/comps-group-list.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
@dnf5daemon
Feature: Tests for group list and info commands

Expand Down
1 change: 0 additions & 1 deletion dnf-behave-tests/dnf/comps-group-pkgremove.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@dnf5
Feature: Test removal packages along with group

# Self-dependent package is a package that requires and provides the same capability.
Expand Down
Loading
Loading