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

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

azgabur
Copy link
Contributor

@azgabur azgabur commented Aug 14, 2024

This change will add image strings of deployed Kuadrants on clusters (including second cluster if defined) 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".

@azgabur azgabur force-pushed the kuadrant_version_print branch from 02f333e to ced4803 Compare August 14, 2024 11:44
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 azgabur force-pushed the kuadrant_version_print branch from ced4803 to 88797f0 Compare August 15, 2024 09:37
@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 force-pushed the kuadrant_version_print branch from 88797f0 to 6865610 Compare August 15, 2024 09:41
@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.

trepel
trepel previously approved these changes Aug 29, 2024
@azgabur azgabur marked this pull request as draft September 12, 2024 11:07
@azgabur azgabur force-pushed the kuadrant_version_print branch from 6865610 to bb240f4 Compare September 25, 2024 07:59
@azgabur azgabur marked this pull request as ready for review September 25, 2024 07:59
Copy link
Contributor

@trepel trepel left a comment

Choose a reason for hiding this comment

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

Approving again, it works for HTML report.

@jsmolar jsmolar merged commit 8ee50f1 into Kuadrant:main Sep 26, 2024
3 checks passed
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