Skip to content

Conversation

@in-manishkr
Copy link
Contributor

What this PR does ?

image_query method provides information about a single or multiple images at once. But does not provide information of where this image is stored.

This PR adds path where the image is stored in zvmsdk to enhance the information shared by zvmsdk.

Apart from that this PR also includes small code optimization in the image_query method which helped in reducing code lines without impacting the actual working

Copy link
Contributor

@Bischoff Bischoff left a comment

Choose a reason for hiding this comment

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

What about modifying this unit test?

   @mock.patch.object(smtclient.SMTClient, '_get_image_last_access_time')
    @mock.patch.object(database.ImageDbOperator, 'image_query_record')
    def test_image_query(self, image_query, access_time):
        image_name = "testimage"
        fake_access_time = 1581910539.3330014
        access_time.return_value = fake_access_time
        image_query.return_value = [{'imagename': 'testimage'}]
        image_info = self._smtclient.image_query(image_name)
        image_query.assert_called_once_with(image_name)
        self.assertEqual(image_info[0]['last_access_time'],
                         fake_access_time)

in zvmsdk/tests/unit/test_smtclient.py

@in-manishkr in-manishkr force-pushed the image_query_enhancement branch from f080052 to 197f8ea Compare August 13, 2025 07:13
@in-manishkr in-manishkr force-pushed the image_query_enhancement branch 2 times, most recently from 71f65fe to 2880c9f Compare September 11, 2025 08:27
@in-manishkr
Copy link
Contributor Author

in-manishkr commented Sep 11, 2025

What about modifying this unit test?

   @mock.patch.object(smtclient.SMTClient, '_get_image_last_access_time')
    @mock.patch.object(database.ImageDbOperator, 'image_query_record')
    def test_image_query(self, image_query, access_time):
        image_name = "testimage"
        fake_access_time = 1581910539.3330014
        access_time.return_value = fake_access_time
        image_query.return_value = [{'imagename': 'testimage'}]
        image_info = self._smtclient.image_query(image_name)
        image_query.assert_called_once_with(image_name)
        self.assertEqual(image_info[0]['last_access_time'],
                         fake_access_time)

in zvmsdk/tests/unit/test_smtclient.py

@Bischoff

As requested, I have updated the test cases to cover image_path . Please re-review and let me know if we need further enhancements

…ptimized image_query method

Signed-off-by: Manish Kumar <Manish.Kumar176@ibm.com>
@in-manishkr in-manishkr force-pushed the image_query_enhancement branch from 2880c9f to fbee763 Compare September 11, 2025 08:31
@Rajat-0 Rajat-0 merged commit 9559b19 into openmainframeproject:master Sep 12, 2025
2 checks passed
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.

3 participants