Skip to content

Tests: provide a way to generate a simple metadata set - #1915

Merged
jku merged 2 commits into
theupdateframework:developfrom
MVrachev:test-statics-data-generation
Mar 23, 2022
Merged

jku merged 2 commits into
theupdateframework:developfrom
MVrachev:test-statics-data-generation

Conversation

@MVrachev

Copy link
Copy Markdown
Collaborator

Continuation from #1898.
Because of a GitHub bug the new changes inside test-static-data-generation branch of my fork
weren't noticed.
That's why I created a new pr.

Related to: #1806

Description of the changes being introduced by the pull request:

I created a new script called "generate_md.py" which can be used
to easily generate a repository. Additionally, I created a new
test file making sure that the locally stored metadata files and
the newly generated metadata roles are the same.
This will allow us to test that we are not changing the metadata
file structure when making changes.

Signed-off-by: Martin Vrachev [email protected]

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

Martin Vrachev added 2 commits March 22, 2022 16:42
A really specific bug occurred on CI runs on all Windows machines
https://github.com/theupdateframework/python-tuf/runs/5467473050?check_suite_focus=true
where we weren't able to verify that what was generated is the same
as the stored on Git.

After research with Jussi, we found out that the problem comes not
from the content of the file that was generated, but because on Windows
Git proactively replaced all line endings for text files with CRLF symbol
("\r") this made the locally stored JSON files different from the one
generated.

We want to make sure such bugs doesn't occur again and that's why we
disable this behavior for all JSON files.

Signed-off-by: Martin Vrachev <[email protected]>
I created a new script called "generate_md.py" which can be used
to easily generate a repository. Additionally, I created a new
test file making sure that the locally stored metadata files and
the newly generated metadata roles are the same.
This will allow us to test that we are not changing the metadata
file structure when making changes.

Signed-off-by: Martin Vrachev <[email protected]>
@MVrachev

Copy link
Copy Markdown
Collaborator Author

@lukpueh because of a GitHub bug the new changes inside test-static-data-generation branch of my fork
weren't noticed. I closed it, but there was no option to reopen it.
That's why I created this new pr.

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 2023507191

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.312%

Totals Coverage Status
Change from base Build 2022257279: 0.0%
Covered Lines: 1179
Relevant Lines: 1195

💛 - Coveralls

@jku jku left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks a lot better and shorter, thanks!

  • The key & signer handling could probably be better (why does the generator function need to construct the signers?) but there's no need to polish everything before we know what the code is going to be like...
  • The error message could mention that new expected results should only be generated if the change in results was expected
  • script only works if run from a specific working directory
  • two separate arguments (dump/verify) is weird: that leads to 4 distinct modes but only two of them make sense...

These are all either trivial or just thoughts for future: I think it's a good start for these tests, approved.

@jku
jku merged commit 05c2959 into theupdateframework:develop Mar 23, 2022
@MVrachev
MVrachev deleted the test-statics-data-generation branch May 18, 2022 14:11
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.

3 participants