-
Notifications
You must be signed in to change notification settings - Fork 6
Configure test suite for edge-endpoint support #139
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -252,6 +252,7 @@ def test_submit_image_query_with_human_review_param(gl: Groundlight, detector: D | |
| assert is_valid_display_result(_image_query.result) | ||
|
|
||
|
|
||
| @pytest.mark.skip_for_edge_endpoint(reason="The edge-endpoint does not support passing metadata.") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we were mentioned yesterday I think, we can also easily support this once we have persistent storage for image queries on the edge.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah but for now we want to unblock other PRs on the edge. And in general we may not be fully feature complete on the edge relative to the cloud. |
||
| @pytest.mark.parametrize("metadata", [None, {}, {"a": 1}, '{"a": 1}']) | ||
| def test_submit_image_query_with_metadata( | ||
| gl: Groundlight, detector: Detector, image: str, metadata: Union[Dict, str, None] | ||
|
|
@@ -267,6 +268,7 @@ def test_submit_image_query_with_metadata( | |
| assert retrieved_iq.metadata == expected_metadata | ||
|
|
||
|
|
||
| @pytest.mark.skip_for_edge_endpoint(reason="The edge-endpoint does not support passing metadata.") | ||
| def test_ask_methods_with_metadata(gl: Groundlight, detector: Detector, image: str): | ||
| metadata = {"a": 1} | ||
| iq = gl.ask_ml(detector=detector.id, image=image, metadata=metadata) | ||
|
|
@@ -280,12 +282,14 @@ def test_ask_methods_with_metadata(gl: Groundlight, detector: Detector, image: s | |
| # assert iq.metadata == metadata | ||
|
|
||
|
|
||
| @pytest.mark.skip_for_edge_endpoint(reason="The edge-endpoint does not support passing metadata.") | ||
| @pytest.mark.parametrize("metadata", ["", "a", b'{"a": 1}']) | ||
| def test_submit_image_query_with_invalid_metadata(gl: Groundlight, detector: Detector, image: str, metadata: Any): | ||
| with pytest.raises(TypeError): | ||
| gl.submit_image_query(detector=detector.id, image=image, human_review="NEVER", metadata=metadata) | ||
|
|
||
|
|
||
| @pytest.mark.skip_for_edge_endpoint(reason="The edge-endpoint does not support passing metadata.") | ||
| def test_submit_image_query_with_metadata_too_large(gl: Groundlight, detector: Detector, image: str): | ||
| with pytest.raises(ValueError): | ||
| gl.submit_image_query( | ||
|
|
@@ -296,6 +300,14 @@ def test_submit_image_query_with_metadata_too_large(gl: Groundlight, detector: D | |
| ) | ||
|
|
||
|
|
||
| @pytest.mark.run_only_for_edge_endpoint | ||
| def test_submit_image_query_with_metadata_returns_user_error(gl: Groundlight, detector: Detector, image: str): | ||
| """On the edge-endpoint, we raise an exception if the user passes metadata.""" | ||
| with pytest.raises(openapi_client.exceptions.ApiException) as exc_info: | ||
| gl.submit_image_query(detector=detector.id, image=image, human_review="NEVER", metadata={"a": 1}) | ||
| assert is_user_error(exc_info.value.status) | ||
|
|
||
|
|
||
| def test_submit_image_query_jpeg_bytes(gl: Groundlight, detector: Detector): | ||
| jpeg = open("test/assets/dog.jpeg", "rb").read() | ||
| _image_query = gl.submit_image_query(detector=detector.id, image=jpeg, human_review="NEVER") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.