aws-solutions-library-samples / osml-model-runner

MIT No Attribution
7 stars 1 forks source link

fix: remove noop model logic #95

Closed drduhe closed 1 month ago

drduhe commented 1 month ago

Issue #, if available: n/a

Notes

This PR replaces the real find_features method of the SMDetector class with a mocked version of (invoke_endpoint) called by the SageMaker client during testing, simulating a GeoJSON response from a SageMaker model without real endpoint invocations. Removing any logic for supporting NOOP models in the find features methods in the associated Detection classes.

Key Changes:

  1. Mocking find_features:

    • Added mock_find_features to simulate model inference, returning a GeoJSON FeatureCollection.
    • Patched find_features in SMDetector using unittest.mock.patch.object to use the mock in tests.
  2. Updated Unit Test (test_process_bounds_image_request):

    • Integrated mock_find_features into the SMDetector instance for controlled testing.
    • Retained Stubber to simulate the SageMaker client response for invoke_endpoint.

Benefits:

Testing:

Checklist

Before you submit a pull request, please make sure you have the following:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.