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

test: fix the testcase strings to not include osinfo_template #680

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Oct 17, 2024

This commit fixes the testcase string representation to not include the osinfo_template string and adds a test case to not accidentally regress here. Currently our test case strings look like:

<Dir bootc-image-builder>
  <Dir test>
    <Module test_build.py>
      <Function test_container_builds>
      <Function test_image_is_generated[quay.io/centos-bootc/centos-bootc:stream9,qcow2+raw+vmdk+vhd+gce,CentOS Stream 9 ({arch})]>
      <Function test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch})]>
...

which is an accident (not the {arch} part in the output above). A testcase should ideally only contain what

Instead of putting the osinfo_template into the testcase itself, have a function that generates it. It has downsides (now the osinfo_template is more disconnected from the testcase) so we could move it also back into testcase or we could exclude osinfo_template from the string generation. Ideas welcome here, my current approach feels okay but not like it's perfect yet.

Copy link
Contributor

@mmartinv mmartinv left a comment

Choose a reason for hiding this comment

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

Why just not moving all the osinfo information to the osinfo_for function?

test/test_build.py Show resolved Hide resolved
test/test_build.py Show resolved Hide resolved
@mvo5
Copy link
Collaborator Author

mvo5 commented Oct 24, 2024

Why just not moving all the osinfo information to the osinfo_for function?

Thank you, that is an excellent suggestion, I updated the code based on your suggestion (will probably have to force push again and if you don't mind squash) because I think the linter will not be happy.

@mmartinv
Copy link
Contributor

@mvo5 why do you removed my suggestion? wasn't it working?

@mvo5
Copy link
Collaborator Author

mvo5 commented Oct 30, 2024

@mvo5 why do you removed my suggestion? wasn't it working?

@mmartinv I'm deeply sorry, I'm a Muppet, I thought I applied the suggestion and pushed but clearly I did not, I am fixing this now, thanks for noticing.

@mvo5 mvo5 requested a review from ondrejbudai November 5, 2024 09:36
ondrejbudai
ondrejbudai previously approved these changes Nov 5, 2024
Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@achilleas-k
Copy link
Member

Merge conflict :(

This commit fixes the testcase string representation to not include
the `osinfo_template` string and adds a test case to not accidentally
regress here. Currently our test case strings look like:
```
<Dir bootc-image-builder>
  <Dir test>
    <Module test_build.py>
      <Function test_container_builds>
      <Function test_image_is_generated[quay.io/centos-bootc/centos-bootc:stream9,qcow2+raw+vmdk+vhd+gce,CentOS Stream 9 ({arch})]>
      <Function test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch})]>
...
```
which is an accident. A testcase should ideally only contain what

Instead of putting the osinfo_template into the testcase itself,
have a function that generates it. It has downsides (now the
osinfo_template is more disconnected from the testcase) so we could
move it also back into testcase or we could exclude osinfo_template
from the string generation. Ideas welcome here, my current approach
feels okay but not like it's perfect yet.
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