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

Add a lint check for empty and missing environment files #3204

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mcasquer
Copy link
Contributor

@mcasquer mcasquer commented Sep 11, 2024

New function that raises a failure if the size of
the environment file, if this one exists, is zero.

Pull Request Checklist

  • implement the feature
  • extend the test coverage
  • include a release note

tmt/base.py Outdated Show resolved Hide resolved
tmt/base.py Outdated Show resolved Hide resolved
tmt/base.py Outdated Show resolved Hide resolved
@mcasquer mcasquer force-pushed the 2872_empty_env_files branch 2 times, most recently from ef711a8 to c2b295a Compare September 12, 2024 12:16
@mcasquer mcasquer marked this pull request as ready for review September 18, 2024 05:52
@happz happz added the command | lint tmt lint command label Sep 23, 2024
@happz happz added this to the 1.37 milestone Sep 23, 2024
@happz happz added the status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. label Sep 24, 2024
Copy link
Collaborator

@psss psss left a comment

Choose a reason for hiding this comment

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

Thanks for improving this! Added a couple comments. Would be good to handle the non-existent file as part of the lint report instead of bailing out with a catched exception.

Would you mind adding a simple test coverage? You could just extend the existing test. Also, what about adding a short release note?

tmt/base.py Outdated Show resolved Hide resolved
tmt/base.py Outdated Show resolved Hide resolved
tmt/base.py Outdated Show resolved Hide resolved
@psss psss removed the status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. label Sep 24, 2024
@psss psss changed the title Adds new function for empty env files Add a lint check for empty and missing environment files Sep 24, 2024
tmt/base.py Outdated Show resolved Hide resolved
tmt/base.py Outdated Show resolved Hide resolved
@psss psss added the status | need tests Test coverage to be added for the affected code label Oct 1, 2024
@psss
Copy link
Collaborator

psss commented Oct 1, 2024

Would you mind adding a simple test coverage? You could just extend the existing test. Also, what about adding a short release note?

@mcasquer, what do you think about adding a simple test and a short release note?

@mcasquer
Copy link
Contributor Author

mcasquer commented Oct 1, 2024

Would you mind adding a simple test coverage? You could just extend the existing test. Also, what about adding a short release note?

@mcasquer, what do you think about adding a simple test and a short release note?

Perfect, I will add them along with the above suggestions !

@mcasquer mcasquer force-pushed the 2872_empty_env_files branch 3 times, most recently from fbf2a76 to 22a3061 Compare October 1, 2024 13:38
@psss psss modified the milestones: 1.37, 1.38 Oct 1, 2024
@mcasquer mcasquer force-pushed the 2872_empty_env_files branch 3 times, most recently from 3cd24be to b5890c4 Compare October 2, 2024 09:45
Copy link
Collaborator

@psss psss left a comment

Choose a reason for hiding this comment

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

Now looks good, thanks! Added just a few minor adjustments in 2ec0304.

@psss psss added status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. ci | full test Pull request is ready for the full test execution labels Oct 17, 2024
mcasquer and others added 2 commits October 17, 2024 18:56
New function that raises a failure if the size of
the environment file, if this one exists, is zero.

Signed-off-by: mcasquer <mcasquer@redhat.com>
@psss
Copy link
Collaborator

psss commented Oct 17, 2024

/packit test

@psss
Copy link
Collaborator

psss commented Oct 17, 2024

/packit build

@psss psss removed status | need tests Test coverage to be added for the affected code status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. labels Oct 17, 2024
@psss
Copy link
Collaborator

psss commented Oct 18, 2024

Test /tests/lint/plan/explicit-root is failing. Seems that your newly added test coverage has revealing a bug. Congratulations! :) Here are simple steps to reproduce:

> cd tests/lint/plan/data
> tmt plan lint good
/good
pass C000 fmf node passes schema validation
pass C001 summary key is set and is reasonably long
pass P001 correct keys are used
pass P002 execute step defined with "how"
pass P003 execute step methods are all known
skip P004 discover step is not defined
skip P005 no remote fmf ids defined
pass P006 phases have unique names
pass P007 execute phase 'default-0' does not require specific guest
pass P008 no empty environment files

Lint checks on all
pass G001 no duplicate ids detected

> cd ..
> tmt --root data plan lint good

[Errno 2] No such file or directory: '/home/psss/git/tmt/tests/lint/plan/env'

Both commands should give the same result as the --root option is instructing tmt to use provided directory as the fmf metadata tree root. Seems that path to the env file is not correctly constructed when --root is used. @mcasquer, could you please have a look?

@mcasquer
Copy link
Contributor Author

Both commands should give the same result as the --root option is instructing tmt to use provided directory as the fmf metadata tree root. Seems that path to the env file is not correctly constructed when --root is used. @mcasquer, could you please have a look?

@psss Ok I will take a look :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution command | lint tmt lint command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants