Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@seberm
Copy link
Contributor

@seberm seberm commented Nov 2, 2024

This PR ensures the dashes are removed from the prefix of the test name (phase name) when calling the rlReport.

Commands located in the BEAKERLIB_COMMAND_REPORT_RESULT variable can badly handle these dashes (e.g. as program arguments when parsing with getopts):

We should also consider adding -- after the $BEAKERLIB_COMMAND_REPORT_RESULT command call to enforce the handling of these arguments as positional. But we are not sure whether rstrnt-report-result or rhts-report-result would handle it as expected:

$BEAKERLIB_COMMAND_REPORT_RESULT -- "$testname" "$result" "$logfile" "$score" || rlLogError "rlReport: Failed to report the result"

Related to:

TODOs:

  • Marked as draft - I still need to test it together with tmt and tmt-report-result script.
  • Add some tests

@sopos
Copy link
Member

sopos commented Nov 4, 2024

@psss , do you know what is the fail there in the CI? It seems to me unrelated to beakerlib.

@martinhoyer
Copy link

/packit build

@packit-as-a-service
Copy link

Account martinhoyer has no write access nor is author of PR!

@psss
Copy link
Member

psss commented Nov 4, 2024

@psss , do you know what is the fail there in the CI? It seems to me unrelated to beakerlib.

Yes, these failures seem to be unrelated:

[   FAIL   ] :: Just two clone calls on non-existent repository (Assert: '2' should equal '10')

This one is weird, will investigate.

[   FAIL   ] :: File '/var/tmp/rlRun_LOG.hYzr5oSy' should contain 'dnf install.*openssl/wrong'

Just different grep needed for dnf5... interesting that this one did not fail in the tmt repo.

[   FAIL   ] :: Command 'tmt run -arvvvddd plan --name strip_git_suffix' (Expected 0, got 2)

Seems to be an rpm conflict for the latest fedora-41.

@seberm
Copy link
Contributor Author

seberm commented Nov 4, 2024

I've added a test that checks the phase name is correctly converted when passed into the rlReport. Feel free to test and review. Thanks!

@seberm seberm marked this pull request as ready for review November 4, 2024 19:23
journalReset

silentIfNotDebug "rlPhaseStartTest '//some/-phase//na--me-'"
assertTrue "Phase name is correctly converted when passing value to rlReport in rlPhaseEnd" "rlPhaseEnd | grep '^some-phase-na-me- '"
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the example, wouldn't it be better to strip the dashes trailing at the end as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's necessary from the perspective of the tmt-report-result script (or other BEAKERLIB_COMMAND_REPORT_RESULT scripts). The trailing dashes shouldn't affect getopts parsing in any way. However, I agree that removing them does make the output look neater.

I've added another sed which removes them.

@seberm seberm force-pushed the fix/remove-dashes-from-test-name-prefix branch from 1bf495a to 47954ef Compare November 4, 2024 22:55
@seberm seberm requested a review from psss November 5, 2024 17:39
@seberm seberm requested a review from sopos November 6, 2024 08:32
@sopos sopos merged commit 1992c38 into beakerlib:master Nov 6, 2024
10 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants