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 Kuadrant version to pytest report #511

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

Conversation

azgabur
Copy link
Contributor

@azgabur azgabur commented Aug 14, 2024

This change will add image strings of deployed Kuadrants on clusters (including multicluster) in pytest report header when running testsuite with make targets. This string is taken from CatalogSource object and in case the object is not found, no string will be printed. In the future this can be expanded for Kind setup, or doing smarter job in finding the right CatalogSource.

This can make debugging easier and is mostly helpful for figuring out nightly build version as the version string in Kuadrant subscription object is "0.0.0".

edit:
DO NOT MERGE - needs refactor

Copy link
Contributor

@averevki averevki left a comment

Choose a reason for hiding this comment

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

Will the image show up on report portal?

@azgabur
Copy link
Contributor Author

azgabur commented Aug 15, 2024

Will the image show up on report portal?

In this state no, as the pytest report header is not included in the junit export, I am investigating how to add this.

@azgabur
Copy link
Contributor Author

azgabur commented Aug 15, 2024

I tried adding this fixture which adds property info to junit file but report portal is not displaying it. Maybe in the future when report portal starts displaying this additional info we can add this, otherwise I did not find any other simple way.

@pytest.fixture(scope="session", autouse=True)
def log_global_env_facts(record_testsuite_property):
    """Adds Kuadrant version in property of testcase in junit."""
    for i, image in enumerate(kuadrant_version()):
        record_testsuite_property(f"KUADRANT_{i}", image[0])

@azgabur
Copy link
Contributor Author

azgabur commented Aug 15, 2024

^ I added just the image info to metadata data structure which will be displayed in "Environment" section when generating html report.

@azgabur azgabur added the enhancement Improvement to existing test label Aug 21, 2024
@trepel
Copy link
Contributor

trepel commented Aug 27, 2024

@azgabur I tried using html=1 make ./testsuite/tests/singlecluster/gateway/test_basic.py and junit=1 make ./testsuite/tests/singlecluster/gateway/test_basic.py. Former worked (even tried with additional clusters), latter did not work for some reason. Any ideas what might have gone wrong?

@azgabur
Copy link
Contributor Author

azgabur commented Aug 29, 2024

junit=1 make ./testsuite/tests/singlecluster/gateway/test_basic.py

In the end I did not implement the junit property carrying the kuadrant image string as the Report portal did not display it so thats why its not included. But just by adding this function (#511 (comment)) to top level conftest it can be later added if needed.

@trepel
Copy link
Contributor

trepel commented Aug 29, 2024

Ah, ok, sorry, I did not get that. If this meant to be about html only, it looks good to me then.

for cluster in clusters:
project = cluster.change_project("openshift-marketplace")
if not project.connected:
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Why break when a catalog or project is not found? For consistency's sake I would expect that we have relevant information in all reports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the catalog source under exact name CatalogSource/kuadrant-upstream inside openshift-marketplace namespace is not found than no version is printed. This is intended. I plan in the future to make the search for version better to work in more circumstances - mainly on Kind.

This feature should be taken just as convince not as production ready and documented feature of the testsuite.

@azgabur azgabur marked this pull request as draft September 12, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants