+
Skip to content

Conversation

mdwelsh
Copy link
Contributor

@mdwelsh mdwelsh commented Oct 26, 2024

This PR uses the Streamlit app testing library (which is incredibly handy) to provide an integration test for the Luna demo.

This is needed because we often find that small changes to Luna or the UI code can break the demo. I need a way to run an integration test when the demo is deployed, and this is it.

The intention is not to run this test as part of CI, since it needs a specifically-configured OpenSearch index. Instead, it will be run as part of the demo deployment process.

The Streamlit AppTest class lets us run a "headless" Streamlit app, interact with it programmatically, and access its state, including all of the UI elements. To make writing test cases easier, I've implemented a few helper functions to walk the UI tree and test specific conditions on it.

I realize that understanding this test code is going to be difficult if you don't know the ins and outs of the Luna demo code itself, but I'm not expecting reviewers to have that background. I'd appreciate your looking for any glaring mistakes or stylistic suggestions. Thanks!

Copy link
Contributor

@karanataryn karanataryn 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 this! Couple of nits and suggestions.

"--exec-mode", type=str, choices=["ray", "local"], default="ray", help="Configure Sycamore execution mode."
)
argparser.add_argument("--chat", action="store_true", help="Only show the chat demo pane.")
argparser.add_argument("--test", action="store_true", help="Only run the integration test.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need both chat and test if both are never used together? Why not a mode argument that is either chat or test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, for now --test is kind of a whole different mode of execution of the entire script, which will subsume a bunch of the other arguments anyway. Maybe the specific test for not using --chat does not make sense in that light.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it would help clarify this architecture better as well. I didn't realize that they encompass overlapping things while reading this script.

@mdwelsh mdwelsh requested a review from karanataryn October 28, 2024 19:29
Copy link
Contributor

@karanataryn karanataryn left a comment

Choose a reason for hiding this comment

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

LGTM!

"--exec-mode", type=str, choices=["ray", "local"], default="ray", help="Configure Sycamore execution mode."
)
argparser.add_argument("--chat", action="store_true", help="Only show the chat demo pane.")
argparser.add_argument("--test", action="store_true", help="Only run the integration test.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it would help clarify this architecture better as well. I didn't realize that they encompass overlapping things while reading this script.

@mdwelsh mdwelsh merged commit 96b61e0 into main Oct 28, 2024
12 of 13 checks passed
@HenryL27 HenryL27 deleted the matt/luna-demo-test branch August 30, 2025 00:03
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.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载