@@ -871,33 +871,36 @@ def _drive_patch(test_microvm):
871871 assert test_microvm .api_session .is_status_bad_request (response .status_code )
872872 assert "at least one property to patch: path_on_host, rate_limiter" in response .text
873873
874+ drive_path = "foo.bar"
875+
874876 # Cannot patch drive permissions post boot.
875877 response = test_microvm .drive .patch (
876- drive_id = "scratch" , path_on_host = "foo.bar" , is_read_only = True
878+ drive_id = "scratch" , path_on_host = drive_path , is_read_only = True
877879 )
878880 assert test_microvm .api_session .is_status_bad_request (response .status_code )
879881 assert "unknown field `is_read_only`" in response .text
880882
881883 # Cannot patch io_engine post boot.
882884 response = test_microvm .drive .patch (
883- drive_id = "scratch" , path_on_host = "foo.bar" , io_engine = "Sync"
885+ drive_id = "scratch" , path_on_host = drive_path , io_engine = "Sync"
884886 )
885887 assert test_microvm .api_session .is_status_bad_request (response .status_code )
886888 assert "unknown field `io_engine`" in response .text
887889
888890 # Updates to `is_root_device` with a valid value are not allowed.
889891 response = test_microvm .drive .patch (
890- drive_id = "scratch" , path_on_host = "foo.bar" , is_root_device = False
892+ drive_id = "scratch" , path_on_host = drive_path , is_root_device = False
891893 )
892894 assert test_microvm .api_session .is_status_bad_request (response .status_code )
893895 assert "unknown field `is_root_device`" in response .text
894896
895897 # Updates to `path_on_host` with an invalid path are not allowed.
896- response = test_microvm .drive .patch (drive_id = "scratch" , path_on_host = "foo.bar" )
898+ response = test_microvm .drive .patch (drive_id = "scratch" , path_on_host = drive_path )
897899 assert test_microvm .api_session .is_status_bad_request (response .status_code )
898900 assert (
899901 "Unable to patch the block device: BackingFile(Os { code: 2, "
900- 'kind: NotFound, message: \\ "No such file or directory\\ " })' in response .text
902+ f'kind: NotFound, message: \\ "No such file or directory\\ " }}, \\ "{ drive_path } \\ ")'
903+ in response .text
901904 )
902905
903906 fs = drive_tools .FilesystemFile (os .path .join (test_microvm .fsfiles , "scratch_new" ))
0 commit comments