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

Verbose mode not working in tmt * show commands #2364

Open
psss opened this issue Sep 27, 2023 · 7 comments · May be fixed by #3445
Open

Verbose mode not working in tmt * show commands #2364

psss opened this issue Sep 27, 2023 · 7 comments · May be fixed by #3445
Assignees
Labels
bug Something isn't working code | cli Changes related to the command line interface priority | should medium priority, should be included in the next release status | blocked The merging of PR is blocked on some other issue
Milestone

Comments

@psss
Copy link
Collaborator

psss commented Sep 27, 2023

It seems that a regression has been introduced in ec6ba65 which breaks tmt test show --verbose:

tmt test show smoke -v

/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag container and virtual
                    tier 0

Verbose mode should include sources, fmf-id and web link:

/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag container and virtual
                    tier 0
                 sources /home/psss/git/tmt/tests/main.fmf
                         /home/psss/git/tmt/tests/core/main.fmf
                         /home/psss/git/tmt/tests/core/smoke/main.fmf
                  fmf-id url: https://github.com/teemtee/tmt.git
                         ref: HEAD
                         name: /tests/core/smoke
                     web https://github.com/teemtee/tmt/tree/HEAD/tests/core/smoke/main.fmf

@happz, could you possibly have a look into this?

@psss psss added bug Something isn't working code | cli Changes related to the command line interface labels Sep 27, 2023
@psss psss added this to the 1.28 milestone Sep 27, 2023
@happz
Copy link
Collaborator

happz commented Sep 27, 2023

@psss are you sure it's caused by the patch you mentioned? I'm getting the same outcome with 1.27.0:

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ type tmt
tmt is hashed (/usr/bin/tmt)
[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ tmt --version
tmt version: 1.27.0 (9c35269a)
[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ tmt test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ tmt test show -v smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ tmt test show -vv smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ 

The position of -v seems to be the decisive factor:

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ tmt test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ tmt -v test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0
                 sources /home/happz/git/tmt/tests/main.fmf
                         /home/happz/git/tmt/tests/core/main.fmf
                         /home/happz/git/tmt/tests/core/smoke/main.fmf
                  fmf-id url: github:teemtee/tmt
                         ref: HEAD
                         name: /tests/core/smoke
                     web github:teemtee/tmt/tree/HEAD/tests/core/smoke/main.fmf

[pts-2:0]: happz@multivac [(HEAD detached at 1.27.0)] ~/git/tmt $ 

The current main seems to be consistent with this:

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt -v test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0
                 sources /home/happz/git/tmt/tests/main.fmf
                         /home/happz/git/tmt/tests/core/main.fmf
                         /home/happz/git/tmt/tests/core/smoke/main.fmf
                  fmf-id url: github:teemtee/tmt
                         ref: main
                         name: /tests/core/smoke
                     web github:teemtee/tmt/tree/main/tests/core/smoke/main.fmf

[pts-2:0]: happz@multivac [main] ~/git/tmt $ 

I guess if there's a regression, it happened earlier than in ec6ba65 :/ Might have happened when I was messing with loggers, for example.

It feels like tests and its subcommands ignore verbosity options:

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt test show -v smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt test -v show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt -v test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0
                 sources /home/happz/git/tmt/tests/main.fmf
                         /home/happz/git/tmt/tests/core/main.fmf
                         /home/happz/git/tmt/tests/core/smoke/main.fmf
                  fmf-id url: github:teemtee/tmt
                         ref: main
                         name: /tests/core/smoke
                     web github:teemtee/tmt/tree/main/tests/core/smoke/main.fmf

[pts-2:0]: happz@multivac [main] ~/git/tmt $ 

And indeed, with this patch:

diff --git a/tmt/cli.py b/tmt/cli.py
index 059ae919..3b546710 100644
--- a/tmt/cli.py
+++ b/tmt/cli.py
@@ -531,7 +531,11 @@ def tests_show(context: Context, **kwargs: Any) -> None:
     Use '.' to select tests under the current working directory.
     """
     tmt.Test.store_cli_invocation(context)
-    for test in context.obj.tree.tests():
+
+    logger = context.obj.logger.clone() \
+        .apply_verbosity_options(**kwargs)
+
+    for test in context.obj.tree.tests(logger=logger):
         test.show()
         echo()

... I get what you're looking for:

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt test show smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0

[pts-2:0]: happz@multivac [main] ~/git/tmt $ hatch run dev:tmt test show -v smoke
/tests/core/smoke
                 summary Just a basic smoke test
                 contact Petr Šplíchal <[email protected]>
                    test tmt --help
                    path /tests/core/smoke
               framework shell
                  manual false
                 require tmt
                duration 5m
                 enabled true
                  result respect
                     tag 'container' and 'virtual'
                    tier 0
                 sources /home/happz/git/tmt/tests/main.fmf
                         /home/happz/git/tmt/tests/core/main.fmf
                         /home/happz/git/tmt/tests/core/smoke/main.fmf
                  fmf-id url: github:teemtee/tmt
                         ref: main
                         name: /tests/core/smoke
                     web github:teemtee/tmt/tree/main/tests/core/smoke/main.fmf

[pts-2:0]: happz@multivac [main] ~/git/tmt $ 

@happz
Copy link
Collaborator

happz commented Sep 27, 2023

So, it's probably been around for some time already. What shall I do about it? :) I can propose a patch, but it won't be a one-liner.

@psss
Copy link
Collaborator Author

psss commented Sep 28, 2023

Yes, indeed, the ec6ba65 commit went to 1.25 so it's with us for quite some time (we definitely need to extend the test coverage here), was surprised myself that quick checking out old branches did not help. Btw, just learned that the commit page on GitHub gives a nice overview of tags where the commit is present:

obrazek

What shall I do about it? :) I can propose a patch, but it won't be a one-liner.

If you could propose a patch, that would be great. Whatever number of lines it would cost :)

@happz happz self-assigned this Sep 29, 2023
@psss
Copy link
Collaborator Author

psss commented Oct 5, 2023

@happz, do you plan to work on this for 1.28 or shall we move it?

@happz
Copy link
Collaborator

happz commented Oct 5, 2023

@psss 1.29, please

@psss psss modified the milestones: 1.28, 1.29 Oct 5, 2023
@happz
Copy link
Collaborator

happz commented Oct 31, 2023

Moving to 1.30. I do have a draft, but I'm not happy about the shape it takes, and I want to find a better way of involving verbosity options in tests & co.

@happz happz modified the milestones: 1.29, 1.30 Oct 31, 2023
@happz
Copy link
Collaborator

happz commented Nov 28, 2023

I can't get the decorator right, trying to add pyright into the mix to help me with annotations in #2520.

@happz happz modified the milestones: 1.30, 1.31 Nov 28, 2023
@happz happz added the status | blocked The merging of PR is blocked on some other issue label Nov 28, 2023
@happz happz changed the title Verbose mode not working in tmt * show commnands Verbose mode not working in tmt * show commands Jan 16, 2024
@psss psss modified the milestones: 1.31, 1.32 Jan 30, 2024
@happz happz removed this from the 1.32 milestone Feb 26, 2024
@lukaszachy lukaszachy added this to the 1.34 milestone Mar 13, 2024
@happz happz modified the milestones: 1.34, 1.35 Jun 11, 2024
@martinhoyer martinhoyer modified the milestones: 1.35, 1.36 Jul 30, 2024
@happz happz removed this from the 1.36 milestone Sep 3, 2024
@psss psss added this to the 1.41 milestone Jan 6, 2025
@happz happz linked a pull request Jan 6, 2025 that will close this issue
2 tasks
@happz happz modified the milestones: 1.41, 1.42 Jan 13, 2025
@thrix thrix added the priority | should medium priority, should be included in the next release label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code | cli Changes related to the command line interface priority | should medium priority, should be included in the next release status | blocked The merging of PR is blocked on some other issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants