File tree Expand file tree Collapse file tree
util/opentelemetry-util-genai/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ def setUp(self):
102102 self .hook = UploadCompletionHook (
103103 base_path = BASE_PATH , max_queue_size = MAXSIZE , lru_cache_max_size = 5
104104 )
105+ # 1 upload is done when creating the UploadHook to ensure upload works. Reset mock.
106+ self .mock_fs .reset_mock ()
105107
106108 def tearDown (self ) -> None :
107109 self .hook .shutdown ()
@@ -145,6 +147,18 @@ def test_upload_then_shutdown(self):
145147 "should have uploaded 4 files" ,
146148 )
147149
150+ def test_failed_upload_causes_initializer_to_throw (self ):
151+ self .mock_fs .open .side_effect = ValueError ("Failed for some reason!" )
152+ with self .assertRaisesRegex (
153+ ValueError ,
154+ "Failed to write file to the following path to test if upload working" ,
155+ ):
156+ UploadCompletionHook (
157+ base_path = BASE_PATH ,
158+ max_queue_size = MAXSIZE ,
159+ lru_cache_max_size = 5 ,
160+ )
161+
148162 def test_lru_cache_works (self ):
149163 record = LogRecord ()
150164 self .hook .on_completion (
You can’t perform that action at this time.
0 commit comments